Quantcast

Odd Vector Behavior

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Odd Vector Behavior

Stan Gorodenski
I have the following syntax:


GET FILE 'SUBDIR\Referencefile'.

select if casenum le 10.

string title (a403) / journal (a201) / author (a302).

string allvars (a1069).

string line1 (a80) / line2 to line14 (a70) / space (a10).

compute title=concat(ltrim(rtrim(title1)),' ',ltrim(rtrim(title2)),'
',ltrim(rtrim(title3)),' ',ltrim(rtrim(title4))).

compute author=concat(ltrim(rtrim(author1)),' ',ltrim(rtrim(author2)),'
',ltrim(rtrim(author3))).

compute journal=concat(ltrim(rtrim(journal1)),' ',ltrim(rtrim(journal2))).

compute allvars=concat(rtrim(author),', ',rtrim(year),'
',rtrim(month),', "',rtrim(title),'", ',

rtrim(citation),', ',rtrim(string(casenum,f5))).

compute line1 = substr(allvars,1,80).

vector line = line2 to line14.

loop #i=2 to 14.

compute line(#i) = substr(allvars,((10+#i*70+1)-70),70).

end loop.




When I run this program I get the following warning mesage for each case:

Warning # 520

The subscript of a string vector is missing, out of range, or not an
integer.

The result will be a reference to a string of length 0.

Command line: 346 Current case: 3 Current splitfile group: 1


The only way this program will work is if I change the string command from
string line2 to line14 (a70)
to
string line2 to line15 (a70)

and change the vector command from

vector line = line2 to line14.
to
vector line = line2 to line15.


Even though the loop goes from 2 to 14 and never goes to 15,  I need to
create another variable, line15, that I will never use and declare it in
the vector command. Can anyone explain this? I have rebooted the
computer with the same result. I also thought that the variable, line1,
might somehow be confusing the vector command and so I changed the name
of this variable but I still got the same result.
Stan

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Loading...