BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
shasank
Quartz | Level 8

Hi Community, 

 

I have an issue that I am trying to resolve and much appreciate any help that can be given. Thank you for your time and help. 

 

I have a dataset that has a list of visits(Shown below)  

Visit NameOrder
Screening1
First Visit2
Week a3
Week aa4
Week b5
Week bb6
Week c7
Week cc8

 

List of Subject IDs. 

IDs
1
2
3
4
5
6
7
8

 

I need to merge these to create a list of visits for each subject. I have shown below how the end dataset should look like for 1 subject. But need it for all the subjects in the same dataset.

 

IDVisit NameOrder
1Screening1
1First Visit2

1

Week a3
1Week aa4
1Week b5
1Week bb6
1Week c7
1Week cc8
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Use a cross join.

proc sql;
create table want as
select id, visit_name, order
from table1 cross join table2
order by id, order;
quit;

View solution in original post

1 REPLY 1
Reeza
Super User
Use a cross join.

proc sql;
create table want as
select id, visit_name, order
from table1 cross join table2
order by id, order;
quit;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 291 views
  • 0 likes
  • 2 in conversation