Folks,
I have two variables on income, and I would like to choose whatever the biggest value is to put in a third one. However, in certain cases they will be the same so I need to let SAS know that in this case it can choose either.
Example
data have ;
input id $ Var1 Var2 Var3 ;
cards;
a1 15000 20000 20000
a2 30000 5000 30000
a3 10000 10000 1000
run;Any help would be welcome
data have ;
input id $ Var1 Var2 ;
cards;
a1 15000 20000 20000
a2 30000 5000 30000
a3 10000 10000 1000
;
run;
data want;
set have;
var3=largest(1,var1,var2);
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.