I have a macro variable &myfiles
which contains a list of the names of four datasets.
%put &myfiles;
cpo.CDR_2016jun cpo.Cog_2016jun cpo.Mile_2016jun cpo.Path_2016jun
Where cpo
is a libname.
I'm trying to create four new datasets with names from another macro variable which I've named &New_Datasets
:
%put &New_Datasets;
CDR Cog Mile Path
I tried to just use a data step like this:
data &New_Datasets;
set &myfiles;
run;
but that resulted in all of the observations of the four data sets referenced in &mylist
being combined and put into each of the four data sets referenced in &New_Datasets
, with the following output from the log:
NOTE: There were 1482 observations read from the data set CPO.CDR_2016JUN.
NOTE: There were 1444 observations read from the data set CPO.COG_2016JUN.
NOTE: There were 255 observations read from the data set CPO.MILE_2016JUN.
NOTE: There were 7 observations read from the data set CPO.PATH_2016JUN.
NOTE: The data set WORK.CDR has 3188 observations and 1580 variables.
NOTE: The data set WORK.COG has 3188 observations and 1580 variables.
NOTE: The data set WORK.MILE has 3188 observations and 1580 variables.
NOTE: The data set WORK.PATH has 3188 observations and 1580 variables.
What I want to accomplish is to have the 1482 observations from cpo.cdr_2016jun
create a data set work.cdr
with 1482 observations and so on, rather than having each of the new data sets be a combination of the ones referenced in the set statement. Any help would be greatly appreciated, thanks!