比如一个数据集里面有1991-2009某股票的价格,但想要按年份输出成外部文件
如图:
D:/ 1998.txt
D:/ 1999.txt
D:/ 2000.txt
D:/ 2001.txt
D:/ 2002.txt
D:/ 2003.txt
D:/ 2004.txt
D:/ 2005.txt
D:/ 2006.txt
D:/ 2007.txt
其中 D:/ 1998.txt 里面有
1998-01-05 24.00 D:/ 1998.txt
1998-01-06 23.84 D:/ 1998.txt
1998-01-07 23.39 D:/ 1998.txt
1998-01-08 23.14 D:/ 1998.txt
1998-01-09 23.06 D:/ 1998.txt
1998-01-12 23.01 D:/ 1998.txt
1998-01-13 22.26 D:/ 1998.txt
1998-01-14 22.53 D:/ 1998.txt
1998-01-15 22.43 D:/ 1998.txt
sas 代码:
libname jzye 'E:/resdat';
proc sort data=jzye.stk000001 out=stk;
by date;
run;
data d;
set stk(keep=date clpr);
year='D:/'||year(date)||'.txt';
run;
data g;
set d;
file files filevar=year mod;
put year;
run;
附件列表