作者men0523 (冒失鬼)
看板Statistics
标题[程式] SAS_如何将资料切割
时间Fri Mar 15 20:27:42 2013
[软体程式类别]:
SAS
[程式问题]:
资料处理
[软体熟悉度]:
新手(不到1个月)
[问题叙述]:
我想要问关於SAS切割档案的问题~
我的档案格式(A)如下:
ID 商品名称 价格 数量
123 AA 10 2
123 Aa 3 10
234 AA 10 1
234
567
789
789
789
.
.
现在我想要切割成依照ID不同各存成不同的资料,如
data 123;set A;if ID^=123 then delete;run;
data 234;set A;if ID^=234 then delete;run;
但由於ID非常多,所以无法像以上这样不停的作,然後我又查了以下写法或许可行:
proc sql noprint;select distinct ID into: tname separated by ' ' from A;quit;
%macro a;%let i=1;%let name=%scan(&tname,&i);%do %while (&name^=());
data _&name;set A(where=(ID="&name"));run;
%let i=%eval(&i+1);%let name=%scan(&tname,&i);%end;%mend a;
但就出现了以下
ERROR: The length of the value of the macro variable TNAME (65540) exceeds
the maximum length (65534). The value has been truncated to 65534 characters.
请各位帮我看看我应该要怎麽修正才能顺利跑出我的资料,谢谢:)
[程式范例]:
-----------------------------------------------------------------------------
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.64.138.139