公卫百科  > 所属分类  >  SAS   
[0] 评论[0] 编辑

SAS Where Statement

The where statement can be used with any procedure to restrict the action of that procedure to observations satisfying the conditions of the where statement. Example:


proc means data=dumb;
where x<5 and y>3;
run;


Here proc means analyzes only the observations in the data set dumb for which x<5 and y>3.

公卫考场



Similar behavior can be obtained by using the where = data set option.

The where statement can be used in conjunction with the set statement to select observations from an existing data set. Here's an example.

Suppose the data set iris contains variables species and m1-m4. Then 公卫家园


data onetwo;
set iris;
where species=1 or species=2;
run;


creates a new data set onetwo containing the data for species 1 and species 2 only. The logical connecitives and and or can be used to create more complicated selection schemes. 公卫论坛

The where statement provides more efficient processing than the subsetting if statement. SAS functions can NOT be used within the where statement, but are allowed in a subsetting if statement.

附件列表


0

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

如果您认为本词条还有待完善,请 编辑

上一篇 SAS X Command    下一篇 SAS Updating Data Sets

标签

暂无标签

同义词

暂无同义词