BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
zimcom
Pyrite | Level 9

 

 

data want; set have;
retain z;
if first.SUBJECT then z = 1;
else z = z + 1;
by SUBJECT;
run;

 

After I run the above code, how can I remove the SUBJECT if last.SUBJECT is less than 3 (not the observation of "z LT 3", but the SUBJECT), which means if the SUBJECT has less than 4 records, then they will be deleted.

 

Thanks as always

1 ACCEPTED SOLUTION
3 REPLIES 3
zimcom
Pyrite | Level 9
Thank you so much, really appreciated!
zimcom
Pyrite | Level 9

Another related question, in the dataset, now each subject has at least 4 records (up to the maximum of 6). I want to do another subset of only those subjects where the difference between the 2nd to 3rd, 3rd to 4th, 4th to 5th, etc., jumped great than 4 points from the previous one. 

 

Thanks again!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1463 views
  • 1 like
  • 2 in conversation