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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.