BookmarkSubscribeRSS Feed
Thalitacosta
Obsidian | Level 7

I have the following outputs data:

resul_201901

resul_201903

resul_201906

resul_201909

resul_201912

resul_202001

resul_202106

resul_202203

How to join all of them, since the way I'm doing it doesn't work:

 

data Resul_end;

set resul_201901-resul_202203;

run;

 

Is there a way to do without quoting all?

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

This does not join the tables. It merely stacks them. 

 

Please provide sample data in usable form if you want a usable code answer 🙂

PGStats
Opal | Level 21

Build the list with SQL from the DICTIONARY.TABLES dataset:

 

proc sql noprint;
select memname into :sets separated by " "
from dictionary.tables 
where libname="WORK" and memname like "RESUL_20%"
order by memname;
quit;

data Resul_end;
set &sets.;
run;
PG
ballardw
Super User

If those are ALL the Resul_ files in the library:

The : at the end of a base name will build a list of all names that start with those characters

 

 

data want;
   set resul_:  ;
run;

If you have more apparent years and want ALL the sets from 2019, 2020, 2021 and 2022

 

 

data want;
   set resul_2019:  resul_2020: resul_2021:  resul_2022:  ;
run;

 

 

but if you want a random selection not likely to be much of a short cut list possible.

Note Resul_20:  would reference all datasets with a year starting with 20 but can't tell if that is helpful.

 

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 585 views
  • 3 likes
  • 4 in conversation