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;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1 reply
  • 376 views
  • 0 likes
  • 2 in conversation