Re: [問題] 請教SAS一個條件式的問題

看板Statistics作者 ( 將心比心)時間17年前 (2008/05/23 15:55), 編輯推噓2(200)
留言2則, 1人參與, 最新討論串2/2 (看更多)
ss data k1 k2 ; input date id price ; if id=1216 then output k1; if id=2330 then output k2; cards; 20080101 1216 30 20080102 1216 31 20080103 1216 32 20080101 2330 60 20080102 2330 61 20080103 2330 63 ; run; ※ 引述《flyindanger (閃~讓專業的來)》之銘言: : 原資料 : date id price : 20080101 1216 30 : 20080102 1216 31 : 20080103 1216 32 : 20080101 2330 60 : 20080102 2330 61 : 20080103 2330 63 : 想請問一個條件式的問題 : 我想把原資料分別output到不同的兩個資料 k1,k2 : 就是 id=1216時 output到k1的資料裡 : 就是 id=1216時 output到k2的資料裡 : 分別變成可以完整處理的檔案 : ---------------------------------以下是我做的部份 : if id=1216 then output; (無法打output out=k1,在proc means 底下才能這樣做) :if id=2330 then output; (無法打output out=k2,在proc means 底下才能這樣做) : --------------------------------- : 我不想一開始先設data k1; 再set原檔進去 : 請問能在條件式的後面直接處理嗎? : 謝謝各位大大 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.128.140.121

05/23 16:41, , 1F
哦! 所以一開始要先宣告資料k1 k2
05/23 16:41, 1F

05/23 16:44, , 2F
感謝
05/23 16:44, 2F
文章代碼(AID): #18DdXlyj (Statistics)
文章代碼(AID): #18DdXlyj (Statistics)