看板 Statistics 關於我們 聯絡資訊
原文恕刪 如果我沒搞錯你意思,以下程式應該可以解決你問題 data report; input stkno a1 a2 a3; cards; 5738 57 12 96 6374 56 73 35 7384 36 46 37 9999 . 33 23 8888 . . 25 ; run; %macro test(num_a); %do i=1 %to &num_a; data temp&i (keep=stkno a&i); set report; if a&i=. then delete; run; proc sort data=temp&i; by descending a&i; run; data temp&i; set temp&i; call symput("num_data&i",_n_); /* number of data in variable a&i */ run; %do j=1 %to &&num_data&i; data a&i&j (keep=stkno); set temp&i; if _n_=&j; run; %end; %end; %mend; %test(num_a=3); /* number of a */ 另外sas的proc sql應該是沒有ntile的功能 如果妳同學跑得出來,可以請他拿來分享一下嗎 @_@ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.137.190.220
frank1206:S大您好,這個做法好像是把每筆資料都切割成一個檔案? 03/15 20:42
wlsherica:原po希望的出來的檔案分別內容是....??? 03/15 20:56
lsshno1:我原本看你的說明好像也是一筆資料一個檔案 03/15 23:08
frank1206:不好意思 說明的不太清楚,讓各位浪費寶貴時間@@" 03/16 00:46