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

I have two datasets, I would like to use a list of variables from one to pull more detailed information from the first.  An example of the code is attached, I would like to use the &list to pull any number of variables from the list.


1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

So you basically simply want to accomplish a join, but using a list? i.e., if an id is in b, you want the corresponding record(s) from A?

Approximately how many IDs do you have in B?

View solution in original post

4 REPLIES 4
art297
Opal | Level 21

Not sure what you're looking to do with the list. Can you provide and example of how you would like to use such a list?

Steelers_In_DC
Barite | Level 11

I have a large dataset A and a small dataset B.  I want to get a list of ID's from B to pull all the history from A.

I think I've found another step in the process but am still not sure how to use the list:

data test;

do i=1 by 1 while (scan("&list.",i) ne '');

     list=scan("&list.",i);

     output;

end;

drop i;

run;


art297
Opal | Level 21

So you basically simply want to accomplish a join, but using a list? i.e., if an id is in b, you want the corresponding record(s) from A?

Approximately how many IDs do you have in B?

Steelers_In_DC
Barite | Level 11

That's it and I feel silly now over thinking it.  It's just a join, the number of IDs will vary.  I think I know what I'll have to do now.

Thank you for your help.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4 replies
  • 824 views
  • 0 likes
  • 2 in conversation