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;

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

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
  • 843 views
  • 0 likes
  • 2 in conversation