BookmarkSubscribeRSS Feed
RajasekharReddy
Fluorite | Level 6

Hello I am stuck with Retain values for variable ABLFL

 

ABLFL value is "Y" where VISITNUM is 10 and 10.1 and i need retain ABLFL values for same PARAMCD  by USUBJID

 

retain.png

 

4 REPLIES 4
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

 

Please provide your data in a SAS program, so we don't have to do this for you

 

How to convert datasets to data steps
The macro for direct download

 

Provide the expected output and the logic

provide your SAS code that you are working with.

 

Help us help you by providing the items needed to answer your request.

 

 

Astounding
PROC Star

What should the result be for paramcd "GGT"?  It's only at visit 10.01 that ABLFL is "Y".  Do you want that backfilled for visit 10 as well?

RajasekharReddy
Fluorite | Level 6

Hello

 

No I don't want back filled the data

Astounding
PROC Star

It looks like ADT is the variable that can order the observations by date.  (If you prefer to use VISITNUM to do this, that's OK.)

 

Here's a way:

 

proc sort data=have;

by usubjid paramcd adt;

run;

 

data want;

update have have (keep=usubjid paramcd ablfl);

by usubjid paramcd;

output;

run;

 

It's untested code, but should be fine.

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