全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
5185 3
2009-10-15
SAS 中使用
PROC APPEND BASE=a;
可以循环很多次把新生成的行加到原有的base数据文件,但是我现在想要循环很多次把新生成的列(每次新生成3列)加到原有的数据文件上,该怎么做呢?谢谢。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2009-10-15 22:06:25
1# zydisney

如果可以确定顺序和原数据是一致的,使用
复制代码

如果不确定,应使用by。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-10-15 23:23:32
受用了,谢谢楼上二位
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-10-16 09:46:40
There are many ways to do the job. It depends your real situation to evaluate which one is better.

Proc append only appends one data set every time. If you really want to use it, you'd better to use SAS macros to repeat your sas codes. This is a case when you do some simulation jobs, etc.. Here is an example,

option mprint will print all generated SAS code in logs.

%macro loopit(n=10);
proc datasets lib=work;
delete all;
quit;

%do i = 1 %to &n;
    data new;
          dsn=&i;
          do j = 1 to 5;
             x=ranuni(990);
                 output;
          end;
        run;
             
        proc append base=all data=new; run;

        %end;
%mend;
options mprint;
%loopit(n=3)


if one has many small data sets with the same attribution then
data all;
   set w1 w2 w3 w4 w5 w6;
run;

Hope this helps.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群