Re: sas分組加總問題
※ 引述《timlight36 (阿光)》之銘言:
: 程式類別]:
: [程式問題]:
: SAS處理分組加總與輸出
: [軟體熟悉度]:
: 新手(1個禮拜)
: [問題敘述]:
: 各位前輩好
: 我有一份資料
: date time type strike qnty(數量)
: 20060102 0845 c 5000 2
: . . . . .
: . . . . .
: 20060102 1345 c 5000 20
: 20060102 0845 c 5100 4
: . . . . .
: . . . . .
: 20060102 1345 c 5100 34
: 20060102 0845 p 4900 21
: . . . . .
: . . . . .
: 20060102 1345 p 4900 22
: 20060102 0845 p 5000 2
: . . . . .
: . . . . .
: 20060102 1345 p 5000 1
: --------------------------------------------
: 同樣的格式有2006一整年,現在取出一天之中何種type的strike 數量最高
: 例如
: date type stike total_qnty
: 20060102 c 5000 583
: 20060103 p 4900 462
: .
: .
: 20061231 c 6000 5321
: 目前有用proc means算出分組資料,但仍需手動比較與篩選
: 由於資料量太大,懇請各位前輩幫忙!
: 謝謝
兩種做法 不過初學者 我就不用 sql
proc sort data=你算好total_qnty的檔案;by date descending total_qnty;
run;
data a;
set yoursortdata;by date;
if first.date;
run;
這樣就可以了
--
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.81.13.164
討論串 (同標題文章)