BookmarkSubscribeRSS Feed
SerenaJJ
Obsidian | Level 7

Hi, I need to flag the last AVALC = 'Y' record prior to this AVALC='N' record. For example,

for the following dataset, I need to flag the third A record and second B subjid . Thank you so much

 

data have;
input usubjid $ ADY AVALC $;
datalines;
A 15 N
A 36 N
A 57 Y
A 60 N
A 61  Y
A 62 N
A 63 Y
A 64 Y
A 65 Y
B 15 Y
B 36 Y
B 57 N
B 58 N
B 60 Y
;
run;

1 REPLY 1

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 303 views
  • 0 likes
  • 1 in conversation