%macro create_empty_datasets;
%do i = 1 %to 100;
data lib1.ds_&i;
run;
%end;
%mend;
%create_empty_datasets;
proc sql;
create table s as
select libname, memname,memtype
from dictionary.tables
where libname = 'LIB1' /* Change to your library name if different */
and nobs = 0 /* Filters datasets with zero observations */;
quit;
Here I created 100 datasets so how to identify empty datasets ,datasetnames ,observartions count ,variable names info in a Library
First of all, you didn't create 100 empty data sets each of :
data lib1.ds_&i;
run;
has exactly one observation and zero variables, it's because implicit OUTPUT statement being executed at the end of the data step.
To create 100 empty (i.e. zero obs) data set use this:
%macro create_empty_datasets;
%do i = 1 %to 100;
data WORK.ds_&i;
STOP;
run;
%end;
%mend;
and you will see that your query works ok.
Bart
First of all, you didn't create 100 empty data sets each of :
data lib1.ds_&i;
run;
has exactly one observation and zero variables, it's because implicit OUTPUT statement being executed at the end of the data step.
To create 100 empty (i.e. zero obs) data set use this:
%macro create_empty_datasets;
%do i = 1 %to 100;
data WORK.ds_&i;
STOP;
run;
%end;
%mend;
and you will see that your query works ok.
Bart
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.
Ready to level-up your skills? Choose your own adventure.