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

Dear All,

I have a data file showed below:

ID  a1  b1  c1

1   23  35  61

2   76  71  10

3   90        60

4        31   50

5   70 42 

6   35 67  89

I want create a new variable 'd1' with highest number from a1, b1, c1.

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
stat_sas
Ammonite | Level 13

data have;

input ID  a1  b1  c1;

d1=max(of a1--c1);

datalines;

1   23  35  61

2   76  71  10

3   90  .   60

4    .  31  50

5   70  42  .

6   35  67  89

;

View solution in original post

3 REPLIES 3
LinusH
Tourmaline | Level 20

max()

Data never sleeps
stat_sas
Ammonite | Level 13

data have;

input ID  a1  b1  c1;

d1=max(of a1--c1);

datalines;

1   23  35  61

2   76  71  10

3   90  .   60

4    .  31  50

5   70  42  .

6   35  67  89

;

xinjian
Calcite | Level 5

Hi stat@sas and Linush,

Thanks so much for your quick response. I appreciate your help.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1295 views
  • 0 likes
  • 3 in conversation