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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 556 views
  • 2 likes
  • 2 in conversation