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

Hi SAS Community,

I'm having a problem trying to combine 20 datasets using proc sql.  I can do it in a datastep, but is it possible to do with proc sql?

 

data want;

set have_: ;  /*all of my datasets begin with have_*/  /*For instance, have_01, have_02, have_03....etc */

if dc_code = "" then total = total +1;

run;

 

Is it possible to perform this same procedure using proc sql?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

 

Is it possible to perform this same procedure using proc sql?

 

Thanks


No because Proc sql doesn't support variable/dataset name lists. You could perhaps generate sql union operator statements in a macro or using call execute reading dictionary tables, but that's rather tedious. 

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20

 

Is it possible to perform this same procedure using proc sql?

 

Thanks


No because Proc sql doesn't support variable/dataset name lists. You could perhaps generate sql union operator statements in a macro or using call execute reading dictionary tables, but that's rather tedious. 

Reeza
Super User

Is it possible to perform this same procedure using proc sql?

It's possible by listing out the tables or creating a macro that unions all the tables.

Is it efficient or practical to do so? Not really. 

 


@belboy wrote:

Hi SAS Community,

I'm having a problem trying to combine 20 datasets using proc sql.  I can do it in a datastep, but is it possible to do with proc sql?

 

data want;

set have_: ;  /*all of my datasets begin with have_*/  /*For instance, have_01, have_02, have_03....etc */

if dc_code = "" then total = total +1;

run;

 

Is it possible to perform this same procedure using proc sql?

 

Thanks


 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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