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

To find out the non missing values of any particular variable at any particular position with conditional statement like it should be greater than or less than

SUB VISIT SBP DBP WEIGHT

001   1      124   134   180

002   2                        170   

003   3                        178

004   4      345     128   150

005   5      137     167   180

006   1      136     156   178

007   2      145     152    187

008   3                         187


1. Get only latest non-missing values from on or before 3 visit into 3 different data sets for DBP, SBP and Weight variables

2. Merge all three, SBP, DBP, WEIGHT

I appreciate if you guide me.


Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

Your question lacks sufficient details but I will show you what I think you want.  Also,  the values of SUB in your example don't look right and I changed them.

data visit;
   input SUB :$3. VISIT SBP DBP WEIGHT;
   cards;
001   1      124   134   180
001   2        .     .   170  
001   3        .     .    178
001   4      345     128   150
001   5      137     167   180
002   1      136     156   178
002   2      145     152    187
002   3        .       .     187
;;;;
   run;
proc print;
  
run;
data lastnonmiss;
   update visit(obs=0) visit(where=(visit le 3));
   by sub;
   drop visit;
   run;
proc print;
  
run;


4-8-2015 1-54-17 PM.png

View solution in original post

2 REPLIES 2
data_null__
Jade | Level 19

Your question lacks sufficient details but I will show you what I think you want.  Also,  the values of SUB in your example don't look right and I changed them.

data visit;
   input SUB :$3. VISIT SBP DBP WEIGHT;
   cards;
001   1      124   134   180
001   2        .     .   170  
001   3        .     .    178
001   4      345     128   150
001   5      137     167   180
002   1      136     156   178
002   2      145     152    187
002   3        .       .     187
;;;;
   run;
proc print;
  
run;
data lastnonmiss;
   update visit(obs=0) visit(where=(visit le 3));
   by sub;
   drop visit;
   run;
proc print;
  
run;


4-8-2015 1-54-17 PM.png
Ksharp
Super User

John,

If I understood right. OP want this:

001   1     124   134   180

001   2        .        .   170  

001   3        .     90    178

001   4      345     128   150

001   5      137     167   180

002   1      136     156   178

002   2      145     152    187

002   3        .       .     187

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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