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.

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
  • 5 replies
  • 784 views
  • 1 like
  • 4 in conversation