BookmarkSubscribeRSS Feed
Dunne
Obsidian | Level 7

Hello,

 

Could anyone help me with? I want if any dx1-dx4 <=9 the generate a variate dx with the smallest dx (ex id=4 the smallest dx <-9 is of dx2). If all dx1-dx4 >9 then take the value of the smallest dx but not the value of 999.

 

Iddx1dx2dx3dx4
11210999
21011813
399910  
413145
5912 13

 

 

and I want the result looks like this

 

id dx
11
28
310
41
59

 

Thank you,

1 REPLY 1
Astounding
PROC Star

Why should ID 5 generate 9, and not 1?

 

Except for that, a short program would do:

 

data want;

set have;

dx = min(of dx1-dx4);

if dx=999 then dx=.;

run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 523 views
  • 0 likes
  • 2 in conversation