I have a dataset that is sorted by 6 variables.
I want to use the first.variable ( in my case the sixth variable) to set initial values for a new variables (7th,8th variables) of the data set.
Example:
if first.variable_name then do;
ratevalue = 999;
factor = 100.00;
end;
the first.variable is the 6th variable in the groupby.
The first column in the group has a date value of '3-20-2017' hardcoded. So there is only 1 group with the fist column comprising of all 200K observations.
Question is when I execute the above piece of code I am expecting the ratevalue and factor assigned to the observations where first.variable_name = '1'.
However, the the values are assigned to all the 200k observation starting with the first.variable.
If i use
if last.variable_name then do;
'ratevalue = 999;'
factor = 100.00;
end;
then it is assigning the above values to all the observations starting from the last observation of the group made by the 6th variable in the group.
Is that how it is supposed to work.
Thanks!