2011-10-07 81 views
1

我想基本上做到這一點:SAS - 查找列值,並顯示在Excel中值出口

我有一個數據集運行頻率查詢將輸出結果在Excel中。

我也想一列添加到輸出中的值將根據什麼是在特定細胞或特定的列中列出。

我該怎麼辦? (*非常新的SAS用戶)

+0

你能舉個例子,或者說多一點有關你想要做什麼? – itzy

回答

1

沒有聽到更多的信息,我假設你正在試圖做的是保存PROC頻率的輸出,然後用數據進一步操縱它。

的這個簡單的例子:

data beer; 
    length firstname favbrand $20.; 
    input firstname $ 
     favbrand $; 
    datalines; 
John bud 
Steve dogfishhead 
Jason coors 
Anna anchorsteam 
Bob bud 
Dan bud 
; 
run; 

proc freq data=beer; 
    table favbrand/out=freqout; 
run; 

data beerstat(keep=favbrand status); 
    set freqout; 
    * create a new column called "status" based on the count column ; 
    if (count >=2) then status="popular"; 
    else status = "hipster"; 
run; 

* instead of proc print you can send your output to excel with proc export ; 
proc print data=beerstat; 
run; 
相關問題