I have a matched population (1:2) as reported below.
I want that the two controls to get the same "rhythm" variable as the matched case instead of missing. Any suggestion to how to program it?
caseid event rhythm
1 0 .
1 0 .
1 1 1
2 0 .
2 0 .
2 1 2
3 0 .
3 0 .
3 1 1
Lke this?
data have;
input caseid event rhythm;
datalines;
1 0 .
1 0 .
1 1 1
2 0 .
2 0 .
2 1 2
3 0 .
3 0 .
3 1 1
;
proc sql;
create table want as
select caseId, event, max(rhythm) as rhythm
from have
group by caseId
order by caseId, event;
quit;
Lke this?
data have;
input caseid event rhythm;
datalines;
1 0 .
1 0 .
1 1 1
2 0 .
2 0 .
2 1 2
3 0 .
3 0 .
3 1 1
;
proc sql;
create table want as
select caseId, event, max(rhythm) as rhythm
from have
group by caseId
order by caseId, event;
quit;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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 save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.