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

 

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

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