BookmarkSubscribeRSS Feed
kt_080517
Calcite | Level 5

SAS.JPG

 

I have this dataset, and I want to flag the instance where the status changes. I want to see at the first time the status changes, what is the number of tests received. 

2 REPLIES 2
novinosrin
Tourmaline | Level 20

Please post data as text rather than pics for us to copy paste easily

 

Also, post a sample of what you HAVE and what you WANT with your description

Reeza
Super User

Is this what you have, or what you want? Have you tried anything so far to solve this, if so please include that. 

I'm assuming you also want this for each SUBJECT? How do you want them identified, in a separate data set, in a new variable, what value should it be? What about the other records?

 

If you post data as an image we can't work with that, but we can work with text. Otherwise, you'll get general approaches rather than code.

 

In general, You can look at RETAIN to hold a value across rows, so you can set some flags once certain conditions are met. 

The NOTSORTED option is great with BY GROUPS to identify groups that may not be in a conventional sort order but where the sequence is important. 

 


@kt_080517 wrote:

SAS.JPG

 

I have this dataset, and I want to flag the instance where the status changes. I want to see at the first time the status changes, what is the number of tests received. 


 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 2 replies
  • 1127 views
  • 0 likes
  • 3 in conversation