我有一个宏变量&myfiles
其中包含四个数据集的名称列表。基于宏变量值复制/重命名多个sas数据集
%put &myfiles;
cpo.CDR_2016jun cpo.Cog_2016jun cpo.Mile_2016jun cpo.Path_2016jun
其中cpo
是一个libname。
我想从我将其命名&New_Datasets
另一个宏变量创建名称四个新的数据集:
%put &New_Datasets;
CDR Cog Mile Path
我试图只使用一个数据的步骤是这样的:
data &New_Datasets;
set &myfiles;
run;
,但是导致将&mylist
中引用的四个数据集的所有观察结果合并并放入&New_Datasets
中引用的四个数据集的每一个中,其中来自日志的以下输出:
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.
我想做到的是有1482个观察从cpo.cdr_2016jun
创建一个数据集work.cdr
与1482周的观察等,而不是每一个新的数据集是在引用的那些组合设置声明。任何帮助将不胜感激,谢谢!
如果你没有宏变量你会用什么SAS代码来创建你想要的数据集?一旦你知道你想要生成的代码,那么使用宏逻辑来生成它就更容易了。 – Tom