由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - A VERY Tricky SAS question: Help Needed with Baozi
相关主题
新人报道,兼问SAS data set的问题SAS问题来了
SAS base question[合集] SAS里如何实现LOCF(LAST OBS CARRIED FORWARD)?
SAS sampling的问题[合集] 版主帮忙看看,会SAS的都过来看看,好奇怪的SAS问题
求助,sas题目do loop 的一道题
急求~SAS高手请进,一个rolling window类的问题,在线等,非in =option的一道题
再问2道SAS advanced 题目,包子答谢。syntax errors
[合集] Thanks so much! Re: SAS 一问. please helpAsk a SAS Base question?
A SAS problemdata reading question in SAS
相关话题的讨论汇总
话题: john话题: 11111111话题: peter话题: uniqueid话题: 22222222
进入Statistics版参与讨论
1 (共1页)
t**********r
发帖数: 182
1
The data looks like this:
uniqueID, observedate, observer, growthrate,
11111111, 20020908, John, 0.22
11111111, 20021210, John, 0.21
22222222, 19980101, Peter, 0.33
22222222, 19980401, Peter, 0.33
33333333, 19950505, Smith, 0.34
.....
Question;
for each uniqueID, if the name of observer has changed, I need to add one
line of information after the last line to indicate that person has stopped
observing. The observedate is equal to the last date + 3 month.
For example,
11111111, 20020908, John, 0.
c*******o
发帖数: 8869
2
your example does not make sense. for unique ID 11111111, observer does not
change, who is always john. why do you need to add the new line?

【在 t**********r 的大作中提到】
: The data looks like this:
: uniqueID, observedate, observer, growthrate,
: 11111111, 20020908, John, 0.22
: 11111111, 20021210, John, 0.21
: 22222222, 19980101, Peter, 0.33
: 22222222, 19980401, Peter, 0.33
: 33333333, 19950505, Smith, 0.34
: .....
: Question;
: for each uniqueID, if the name of observer has changed, I need to add one

C******t
发帖数: 72
3
Maybe this is what you want. Just be cautious that the variable type is
changed to character to accomodate "stop".
data origin;
input uniqueID $ observedate $ observer $ growthrate $;
datalines;
11111111 20020908 John 0.22
11111111 20021210 John 0.21
22222222 19980101 Peter 0.33
22222222 19980401 Peter 0.33
33333333 19950505 Smith 0.34
;
run;
data addstop;
set origin;
if last.uniqueID then do;
output;
growthrate='stop';
output;
end;
else output;
by uniqueID;
run;
t**********r
发帖数: 182
4
thanks. pls check baozi.
1 (共1页)
进入Statistics版参与讨论
相关主题
data reading question in SAS急求~SAS高手请进,一个rolling window类的问题,在线等,非
急了,问道SAS题,(下午考)再问2道SAS advanced 题目,包子答谢。
[合集] 问一个SAS 从excel import数据的问题[合集] Thanks so much! Re: SAS 一问. please help
请教一道SAS Base的问题A SAS problem
新人报道,兼问SAS data set的问题SAS问题来了
SAS base question[合集] SAS里如何实现LOCF(LAST OBS CARRIED FORWARD)?
SAS sampling的问题[合集] 版主帮忙看看,会SAS的都过来看看,好奇怪的SAS问题
求助,sas题目do loop 的一道题
相关话题的讨论汇总
话题: john话题: 11111111话题: peter话题: uniqueid话题: 22222222