Re: [程式] SAS macro的使用

看板Statistics作者 (dd)時間10年前 (2015/03/24 16:51), 10年前編輯推噓2(201)
留言3則, 3人參與, 最新討論串2/2 (看更多)
※ 引述《LittleMore (LittleMore)》之銘言: : [軟體程式類別]:sas : [程式問題]:macro的使用 : [軟體熟悉度]:低(1~3個月) : [問題敘述]: : 我有一筆資料 需要抓出5天、10天資料....到40天 : 但用手動更改太慢 我想請問要如何改成marco使用 : 以往我只會用%do i=1 %to 10 : %let day=5; : /*抓出五天*/ : data temp_5d; : set temp; : if time<=&day and time>0; : run; 年代太久遠code細節有點忘只能看幫不幫的了 macro test(day); data temp_&day.d; set temp; if time <=&day. and time >0; run; %macro (這邊非常不確定就是結速macro的意思) test(5) 這邊會建立一個temp_5d的檔案,也是5天的結果 test(10) temp_10d 10天 test(20) 同理 只要改裏面數字就好 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.240.202.29 ※ 文章網址: https://www.ptt.cc/bbs/Statistics/M.1427187101.A.B6C.html

03/24 16:52, , 1F
CODE的細節上我怕會有錯誤,太久沒用,手邊也沒有以前寫的
03/24 16:52, 1F
※ 編輯: tevil (111.240.202.29), 03/24/2015 16:52:58

03/24 18:38, , 2F
%macro 開頭 %mend;結尾
03/24 18:38, 2F

03/26 08:59, , 3F
非常謝謝你~^^ 有空時一定來試試看
03/26 08:59, 3F
文章代碼(AID): #1L4IMTji (Statistics)
討論串 (同標題文章)
文章代碼(AID): #1L4IMTji (Statistics)