BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ksharp
Super User

Can you post the OUTPUT you want ?

 

 

data have;
input ID $       JOB   $ as  ;
cards;
A-0-0082 X 25
A-0-0082 Y 25 yes 
A-0-0082 Z 25
A-0-0111 Y 36 no 
A-0-0111 C 36 no
B-0-0012 D 20 no
B-0-0012 Y .  yes
B-0-0012 Y 40 no 
;
run;

data temp;
 set have;
 by id job notsorted;
 group+first.job;
run;
data want;
 set temp;
 by group;
 if last.group and job='Y';
run;
Skillside
Calcite | Level 5

I would like to have something like this:

ID

Job

Age

Diagnosis of ms

VARIABLE N etc.

A-0-0082

Y

25

yes

 

A-0-0111

Y

36

no

 

B-0-0012

Y

40

no

 

Ksharp
Super User

En, So Did you run my code ? Is that what you are looking for ?

Skillside
Calcite | Level 5

Yes, thank you so much!

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
  • 18 replies
  • 2369 views
  • 0 likes
  • 4 in conversation