2017-02-26 134 views
1

我試圖找到物種Pikesashelp.fish的重量和身高的皮爾森相關係數,但我有問題返回結果專門爲派克。這裏是我的代碼:PROC CORR皮爾遜的分類變量

proc corr data=sashelp.fish pearson; 
var height width; 
by species; 
run; 

而這裏的錯誤消息:

Data set SASHELP.FISH is not sorted in ascending sequence. The current BY group has Species = Whitefish and the next BY group has Species = Parkki

我嘗試使用PROC SORTSpecies對數據進行排序,但收到錯誤消息「用戶沒有適用於庫SASHELP的授權級別」。

謝謝!

+0

這將是一個更好的問題,如果標題相關的實際問題。 – david25272

回答

1

如果您沒有指定輸出數據集,那麼默認情況下SAS會用新的排序數據覆蓋輸入數據。但是,您沒有對sashelp庫的寫入訪問權限,無法替換sashelp.fish數據集。因此,你需要創建一個新的有序輸出數據集,然後就可以運行proc corr:使用臨時工作庫

例子:

proc sort data = sashelp.fish out = work.fish; 
    by species; 
run; 

proc corr data=fish pearson; 
    var height width; 
    by species; 
run;