What if a value was over 50? What if your data looks like this?
Data ex1;
Input number ;
Cards;
3
9
22
34
49
3
33
50
51
12
23
34
48
;
See if this works for you 🙂
data ex2(drop=lagnum);
set ex1;
if _N_=1 then seq=1;
lagnum=lag1(number);
if lagnum gt number then seq+1;
run;
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.