BookmarkSubscribeRSS Feed
sfffdg
Obsidian | Level 7

Hi ,

 

Help me achieving the below result from the query attached.

 

name age gender colr skindis
sa 33 F brown 
Sb 39 M fair More
AY 11 M fair More
SA 8 F brown 

 

Current output for the query attached is:

name age gender colr skindis
sa 33 F brown 
Sb 39 M fair More
AY 11 M fair More
SA 8 F brown More

1 REPLY 1
ballardw
Super User

Why the RSUBMIT /ENDRSUBMIT?

Please provide the rules involved. Examples without the rules are often not sufficient to get a get a general solution.

 

Unless your code is really long, say more than a couple of hundred lines it is better to post the code into a code box so every one can see the code involved. Copy from the editor and paste into a box on the forum opened with either the </> or "running man" icon that appears above the main message box such as:

rsubmit;
data a;
input name $ age gender $;
cards;
sa 33 F
Sb 39 M
AY 11 M
SA 8 F
Ny Fair
;
run;
endrsubmit;

rsubmit;
data b(index=(name));
input name $ colr $ ;
cards;
sa brown
sa fair
Sb fair
AY fair
SA brown
Sy Fair
;
run;
endrsubmit;

rsubmit;
data c(index=(colr));
input colr $ skindis $ SD $;
cards;
Brown Medium MD
fair More MR
Black less LS
;
run;
endrsubmit;

rsubmit;
data cb;

set a;
set b (keep= name colr) key=name /unique;
if _error_ = 1 then do;
_error_ = 0;

end;
set c (keep= colr skindis) key=colr /unique;
if _error_ = 1 then do;
_error_ = 0;

end;
run;
endrsubmit;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 609 views
  • 0 likes
  • 2 in conversation