2014-05-16 79 views
0
 Variable  ParameterEstimate 
    slope     1 
    intercept    2.5 
    slope     2 
    intercept    5.6 
    slope    22.2 
    intercept    9 

假設我的數據集看起來像這樣,在變量名是VariableParameterEstimate。我想提取斜率的ParameterEstimates。但是,我想不出一個簡單的方法來做到這一點。我該如何才能得到斜坡,即1,2和22.2?如何子集數據SAS

回答

0

您可以使用一個子集where子句是這樣的:

data want; 
set have; 
where variable = 'slope'; 
run; 

這從數據只能讀取這些意見集「有」,其中變量的值等於「坡」

0

取決於你」接下來再做一次,你可以在沒有單獨的datastep的情況下做到這一點。

說你想要的山坡平均:

proc means data=have(where=(variable='slope')); 
var parameterEstimate; 
run; 

在大多數情況下,你可以使用where數據集選項,除非你有必要創建一個新的數據集(或許你會使用這個子集有50個不同的步驟,或者有些比較容易創建一個,而不是輸出50次)。