2014-05-16 81 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次)。