由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - SAS Code question? How to understand this output?
相关主题
SAS菜鸟请教如果使SAS的output的结果放到一个文件内?双包子求教:SAS问题
SAS question请教SAS问题
SAS问题请教请教一sas code
新人求问SAS简单问题~~a SAS question
高手救命!SAS DATA 求助
What's the wrong with this SAS code?SAS高手请进:20包子
which route in SAS is faster?问个SAS output的问题
求教一个简单的data step 牛肉包关于SAS里面 PROC MODEL 的output,急!!
相关话题的讨论汇总
话题: temp话题: set话题: wbh话题: code话题: run
进入Statistics版参与讨论
1 (共1页)
w*******n
发帖数: 469
1
data temp;
input x y $;
cards;
1 A
2 B
3 C
4 D
5 E
6 F
7 G
8 H
9 I
10 J
;
run;
data wbh;
set temp(keep=x );
if x>2;
set temp(in=B);
run;
proc print;run;
n****t
发帖数: 182
2
This code is the same as
data wbh;


set temp(in=B);
if x>2;
run;
Reason:
1. The variable x is already in temp, so temp(keep=x) does nothing.
2. No matter where you put the "set" statement, it always execute before the
"if" statement (as "if" is a loop over all rows, but set is not)
3. if you want to subset with "set", use "where" within set.
d**s
发帖数: 1255
3
有意思。感觉是这样的
这里keep in 都是花招
if x > 2 决定了wbh 的 number of observation, say n
最后set temp(in=B), 读取了前面 n obs from temp
w*******n
发帖数: 469
4
This output is obviously different. Have you run the coding?

the

【在 n****t 的大作中提到】
: This code is the same as
: data wbh;
:
:
: set temp(in=B);
: if x>2;
: run;
: Reason:
: 1. The variable x is already in temp, so temp(keep=x) does nothing.
: 2. No matter where you put the "set" statement, it always execute before the

w*******n
发帖数: 469
5
Is there any logic for the output here? Hard to understand.
But I accept your interpretation.

【在 d**s 的大作中提到】
: 有意思。感觉是这样的
: 这里keep in 都是花招
: if x > 2 决定了wbh 的 number of observation, say n
: 最后set temp(in=B), 读取了前面 n obs from temp

z**o
发帖数: 149
6
1. set temp(keep=x );
if x>2;
wbh has 8 obs,
x
3
4
5
6
7
8
9
10
2. set temp(in=B);
existed x replaced by new ones; since only 8 obs left,final wbh has 8 rows:
x y
1 A
2 B
3 C
4 D
5 E
6 F
7 G
8 H

【在 w*******n 的大作中提到】
: data temp;
: input x y $;
: cards;
: 1 A
: 2 B
: 3 C
: 4 D
: 5 E
: 6 F
: 7 G

i******r
发帖数: 861
7
cool!!!

【在 z**o 的大作中提到】
: 1. set temp(keep=x );
: if x>2;
: wbh has 8 obs,
: x
: 3
: 4
: 5
: 6
: 7
: 8

1 (共1页)
进入Statistics版参与讨论
相关主题
关于SAS里面 PROC MODEL 的output,急!!高手救命!
SAS -proc transpose 急问!What's the wrong with this SAS code?
[SAS] Efficient way for subsetting data?which route in SAS is faster?
问个SAS入门级的问题。。多谢。。求教一个简单的data step 牛肉包
SAS菜鸟请教如果使SAS的output的结果放到一个文件内?双包子求教:SAS问题
SAS question请教SAS问题
SAS问题请教请教一sas code
新人求问SAS简单问题~~a SAS question
相关话题的讨论汇总
话题: temp话题: set话题: wbh话题: code话题: run