Good afternoon,
I have two datasets I am merging together, one has observations for each participant (age and gender), the other dataset has only a date for each observation:
Obs patient age sex
1 1 23 M
2 2 43 F
3 3 62 F
4 4 41 M
5 5 42 M
Obs date
1 21380
2 21387
3 21394
I'm trying to get each patient to have a row per date:
Obs patient age sex date
1 1 23 M 21380
1 1 23 M 21387
1 1 23 M 21394
2 2 43 F 21380
2 2 43 F 21387
2 2 43 F 21394
3 3 62 F 21380
3 3 62 F 21387
3 3 62 F 21394
4 4 41 M 21380
4 4 41 M 21387
4 4 41 M 21394
5 5 42 M 21380
5 5 42 M 21387
5 5 42 M 21394
Thank you for your help!
A simple cartesian???
proc sql;
create table want as
select a.*,date
from one a,two
order by a.patient,date;
quit;
A simple cartesian???
proc sql;
create table want as
select a.*,date
from one a,two
order by a.patient,date;
quit;
That did it! Thanks for such a quick response.
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!
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.