BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
abraham1
Obsidian | Level 7

Hi All,

The below test data contain information of two sectors (emea, fda).
I want to isolate the datasets for score and event variable based on individual sectors (value for col E-F as 'emea', newly added col G-H as 'fda')

e.g. for record 3, 6,7,8 --> value populated from E-F where as blank for G-H
for record 4,5 --> value populated from G-H where as blank for E-F

Can you please help.

 

data test;
  input pid age gender race event2 $ sector $ score;
cards;
101 21 1 1 fever EMEA 25
102 21 2 2 pain FDA 45 
103 31 1 3 headac FDA 54
104 43 2 4 joint EMEA 66
105 43 2 5 cold EMEA 100
106 75 2 6 anemia EMEA 232
;
run;

Expected output

 

123.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You can produce that report without changing the dataset.

proc report data=test;
column pid age gender race sector,(event2 score);
define pid / group;
define age/group;
define gender/group;
define race/group;
define sector/across;
run;

Tom_0-1669396458434.png

 

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

You can produce that report without changing the dataset.

proc report data=test;
column pid age gender race sector,(event2 score);
define pid / group;
define age/group;
define gender/group;
define race/group;
define sector/across;
run;

Tom_0-1669396458434.png

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1 reply
  • 695 views
  • 1 like
  • 2 in conversation