We are analyzing geological data on a set that has around ~26k measurements (elemental readings) of a seashell. An identical second measurement (isotope readings) took place, it only has a 100 data points (because that's how the machine works).
Now we are trying to (cross)label each 262 cases of the elemental reading (1) to first data point of the isotope reading (2). Thus cases 1-262 = 1, 263 - 525 = 2 and et cetera.
ELSE IF (interval_element >= 1 AND interval_element < 262).
COMPUTE id_element = 1.
ELSE IF (interval_element >= 263 AND interval_element < 526).
COMPUTE id_element = 2.
*etc. to a 100.*
id_element=1 + trunc(($CASENUM-0.1)/262)
First, a more efficient way to do what you're doing: *creating an index variable. sort cases by interval_element. compute IEindex=$casenum.
recode IEindex (1 thru 262=1) (263 thru 524=2) (525 thru 786=3) ....... into id_element.
You'll still have to add 100 lines like this, to create 100 levels in variable id_element, so a more sophisticated approach is called for.
do repeat are usually used to loop through sets of variables. since you only have one variable here, This isn't a classical looping problem. So instead of looping, I suggest a simple calculation that determines
compute id_element=1 + trunc((IEindex-0.1)/262). exe.