Reputation: 33
How can I use syntax to fill specific rows with specific variables. Lets say I want to fill row 1 to 10 in my "location" variable with the integer 1. Rows 10-70 with 2 and so on. There is no programming I just want to fill specific rows of a variable with specific values instead of doing it manually. I tried using vectors and loops but it only works across columns.
Upvotes: 3
Views: 412
Reputation: 34621
The basic syntax would be along the lines of:
do if $casenum le 10.
compute myvar = 1.
else if $casenum le 70.
compute myvar = 2.
else.
compute myvar = 3.
end if.
exe.
Upvotes: 3
Reputation: 2952
Presuming your dataset is already populated, $casenum addresses rows by their row numbers.
Combine with IF for setting values. You may be able to shorten this a bit by using RANGE.
Upvotes: 2