BookmarkSubscribeRSS Feed
pdhokriya
Pyrite | Level 9

Final data should be with money4 column with minimum value in data step or pro sql programming or macro

 

data b ;
input USUBJID MONEY1 MONEY2 MONEY3 ;
cards ;

10001 120 110 300
20001 120 10 300
30002 120 900 90
;
run;

I want output in new column Money4
where i will get min value of (money1 money2 money3)
i.e
Money4
110
10
90

 

Thank you

5 REPLIES 5
novinosrin
Tourmaline | Level 20
data b ;
input USUBJID MONEY1 MONEY2 MONEY3 ;
cards ;

10001 120 110 300
20001 120 10 300
30002 120 900 90
;
run;

data want;
 set b;
 money4=min(of money1-money3);
run;
chaoli
SAS Employee
data b ;
input USUBJID MONEY1 MONEY2 MONEY3 ;
cards ;
10001 120 110 300
20001 120 10 300
30002 120 900 90
;
run;
data a;
  set b;
  MONEY3=min(MONEY1, MONEY2, MONEY3);
run;
pdhokriya
Pyrite | Level 9
Ok Thank you.

What about proc sql syntax?
pdhokriya
Pyrite | Level 9
Thank you , I will try this.
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
  • 5 replies
  • 1297 views
  • 1 like
  • 4 in conversation