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

SAS Output Statement

The output statement is used in the datastep to write the current values of all variables to a data set. There is an IMPLICIT output statement at the end of each datastep iteration UNLESS an output statement appears somewhere in the datastep. The two datastep programs
公卫人



data first;
input x y z;
cards;
...

data second;
input x y z;
output;
cards;
....


will function in an identical manner. If output appears by itself on a line, the data is written to the data set specified at the start of the datastep.

公卫人




data junk;
do i=1 to 20;
input x y z;
x2=x**2;
y2=y**2;
diff=z-x2-y2;
output;
end;
cards;
.....


The output statement here causes the values of the variables i, x, y, z, x2, y2, and diff to be written in the data set junk for each value of i. The data set junk will contain 20 observations. Without the output statement, only the data read when i=20 would appear in junk.
公卫百科


The output statement can be used to create several SAS data sets in a single datastep.


data junk(keep=x y z) treasure(keep=diff);
do i=1 to 20;
input x y z;
output junk;
x2=x**2;
y2=y**2;
diff=z-x2-y2;
output treasure; 公卫百科
end;
cards;
.......
run;


This program creates 2 datasets. Using the keep= data set option causes Junk to contain the variables i, x, y, and z while Treasure contains the single variable diff.

附件列表


0

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

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

上一篇 SAS Pageno Statement    下一篇 SAS Names

标签

暂无标签

同义词

暂无同义词