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.

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