作者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