BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
brandon_hall
Calcite | Level 5

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!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

A simple cartesian???

 

proc sql;
create table want as
select a.*,date
from one a,two 
order by a.patient,date;
quit;

 

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20

A simple cartesian???

 

proc sql;
create table want as
select a.*,date
from one a,two 
order by a.patient,date;
quit;

 

brandon_hall
Calcite | Level 5

That did it! Thanks for such a quick response.

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
  • 2 replies
  • 855 views
  • 2 likes
  • 2 in conversation