SAS By Statement
Used in conjunction with a SAS procedure, the by statement specifies variables in the data set which are used to break the data set into groups for processing by the procedure. The data set is assumed to be sorted in ascending order according to the by variables, but this can be overridden through the use of the descending modifier. The invocation
proc means
data=junk;
var z;
by x descending y;
run;
produces a separate analysis of the z values in the data set junk in each group determined by a specified x and y value. The groupings will appear in order of ascending x values, and within each x value in order of descending y values. 公卫百科
If the modifier notsorted appears in a by statement, processing proceeds for each group of consecutive data having the same value(s) of the by variable(s). This may produce many more groups than desired if the data is not sorted. Example:
by x notsorted; 公卫人
The by statement also causes to temporary logical variables first. and last. to be created. These variables evaluate to true when the current data card corresponds to the first or last card of the by group. Example:
data final;
set first; 公卫论坛
by id;
if first.id;
run;
The data set final will contain only the first entry of each id group.
For further information see the SAS Language Reference.
公卫考场
proc means
data=junk;
var z;
by x descending y;
run;
produces a separate analysis of the z values in the data set junk in each group determined by a specified x and y value. The groupings will appear in order of ascending x values, and within each x value in order of descending y values. 公卫百科
If the modifier notsorted appears in a by statement, processing proceeds for each group of consecutive data having the same value(s) of the by variable(s). This may produce many more groups than desired if the data is not sorted. Example:
by x notsorted; 公卫人
The by statement also causes to temporary logical variables first. and last. to be created. These variables evaluate to true when the current data card corresponds to the first or last card of the by group. Example:
data final;
set first; 公卫论坛
by id;
if first.id;
run;
The data set final will contain only the first entry of each id group.
For further information see the SAS Language Reference.
附件列表
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。
如果您认为本词条还有待完善,请 编辑
上一篇 SAS Cards Statement 下一篇 SAS @ Symbol