【SAS NOTES】在一个data中生成多个数据集

利用if判断+output的选项实现该功能。

 1 data mysas.mmsuser_dec mysas.mmsuser_nov mysas.mmsuser_other;
 2     infile 'E:\SAS\mysas\mmsuser.txt' dlm='09'x firstobs=2;
 3     input date $ city $ a b c d;
 4     if date='201211' then output mysas.mmsuser_dec;
 5     else if date='201212' then output mysas.mmsuser_nov;
 6     else output mysas.mmsuser_other;
 7 run;
 8 proc print data=mysas.mmsuser_dec;
 9 run;
10 proc print data=mysas.mmsuser_nov;
11 run;
12 proc print data=mysas.mmsuser_other;
13 run;

只要在sas写入数据集的过程中都可以使用output来控制输出。

原文地址:https://www.cnblogs.com/colipso/p/2891117.html