How can I set these data sets with names: Fit_1, Fit_2, Fit_5, ..., Fit_1000.
I can not run with this:
##############################
data fit;
set Fit_1 - Fit_100;
output;
run;
##############################
Error: work.fit_3 does not exist.
if you don't have any other data sets whose names start with FIT_ try:
data want;
set fit_: ;
run;
Other wise if you have "numbers" that don't match you leave them out of the stated sequence:
Data want ;
set fit_1 fit_2 fit_4-fit_15 fit_17 - fit_30 ...;
Assuming that the names listed exist and that the ranges where indicated are complete.
if you don't have any other data sets whose names start with FIT_ try:
data want;
set fit_: ;
run;
Other wise if you have "numbers" that don't match you leave them out of the stated sequence:
Data want ;
set fit_1 fit_2 fit_4-fit_15 fit_17 - fit_30 ...;
Assuming that the names listed exist and that the ranges where indicated are complete.
Here is a reference that illustrates how to refer to variables and datasets in a short cut list:
https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html
What happens if you try the double dash instead or colon operator?
@mezerji wrote:
How can I set these data sets with names: Fit_1, Fit_2, Fit_5, ..., Fit_1000.
I can not run with this:
##############################
data fit;
set Fit_1 - Fit_100;
output;
run;
##############################
Error: work.fit_3 does not exist.
If all else fails:
proc sql noprint;
select memname into: TableNames separated by " " from dictionary.tables
where libname = "WORK" and substr(memname, 1, 3) = "FIT" /* Must be uppercase */
order by memname;
quit;
%put &TableNames.;
data fit;
set &TableNames.;
output;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.