BookmarkSubscribeRSS Feed
Sean_OConnor
Fluorite | Level 6

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 

2 REPLIES 2
novinosrin
Tourmaline | Level 20

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;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 484 views
  • 0 likes
  • 3 in conversation