0
我有幾個變量,其中有不同的分數標度。 我可以運行'proc means'並根據MIN和MAX來決定我的數據是否有錯誤。 如何在proc means步驟中爲參數添加條件?例如, ; 如果我的變種X分鐘值低於1和max是以上低於1或高於5 ,如果我的變種ý最小值低於0或高於1 => 然後我希望它打印出來proc意味着打印條件統計信息
有可能這樣做嗎?
我有幾個變量,其中有不同的分數標度。 我可以運行'proc means'並根據MIN和MAX來決定我的數據是否有錯誤。 如何在proc means步驟中爲參數添加條件?例如, ; 如果我的變種X分鐘值低於1和max是以上低於1或高於5 ,如果我的變種ý最小值低於0或高於1 => 然後我希望它打印出來proc意味着打印條件統計信息
有可能這樣做嗎?
我不知道你如何動態需要你的條件是,但如果你想看到亞組的全部彙總統計數據(例如在下面例如,通過sex
和age
),其違約的彙總統計一定條件下(如weight
在下面的例子中height
),那麼你,你可以做到以下幾點:
* Generate summary statistics dataset ;
proc summary data=sashelp.class nway ;
class sex age ;
var weight height ;
output out=sumstats;
run ;
* Subset previous dataset to only cases where conditions are met ;
* Height <= 55 ;
* Weight >= 100 ;
proc sql ;
create table subset as
select a.*
from sumstats as a
right join
(select sex, age
from sumstats
/**** Define summary stat criteria here ****/
where (_stat_='MIN' and height le 55)
or (_stat_='MAX' and weight ge 100)) as b
on a.sex=b.sex
and a.age=b.age
;quit ;
這最後的子數據集包括用於只有符合所有規定的標準子組的全部彙總統計
我需要做的這一個不同於sql的方式。假設我檢測到了我需要的變量,我想打印出下列條件的id,但它給了我關於「where」子句的錯誤,是否可以使用proc打印步驟和「where」語句=> proc print data = comb; var id; 其中q3不在(1,2,3,4,5); 其中q2不在(1,2,3,4,5); 其中q10不在(1,2,3,4,5); 哪裏性別不在(0,1); 哪裏結婚不在(0,1); 跑; – user3581800