Re: [問題] SAS的問題
※ 引述《dolby (dolby)》之銘言:
: 請問大大,
: 我有一個資料檔,包含了幾家公司的一段期間報酬(例如五年)
: 如果我只要其中的某短期間(其中的三年)
: 我要如何下指令呢?
year 是你的年變項 1991~1995
我假設1992 1993 1994是你的其中三年要求的資料
寫法可以這麼做
data a;
set yourfile;
if 1992<=year<=1994 then output;
run;
也可以這麼寫
data a;
set yourfile;
if year=1991 then delete;
if year=1995 then delete;
run;
最後一個寫法
data a;
set yourfile;
if year=1992 then output;
if year=1993 then output;
if year=1994 then output;
run;
根據使用情況 可以利用刪除法 (delete) 和輸出法 (output)
請加油
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 134.208.32.109
討論串 (同標題文章)