boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - SAS question (紧急求助,在线等)
相关主题
SAS question (urgent)
SAS question
问SAS code怎么写
请教大家一个SAS问题
[合集] SAS里如何实现LOCF(LAST OBS CARRIED FORWARD)?
遇到个SAS 问题,求教
SAS question (紧急求助,在线等)
SAS question, the data have been changed (紧急求助,在线等)
SAS question
SAS 问题
相关话题的讨论汇总
话题: 2010话题: 2011话题: drug话题: date话题: dataset
进入Statistics版参与讨论
1 (共1页)
e*******e
发帖数: 75
1
Hi,
I have a dataset as follows:
patient_ID drug drug_start_date drug_end_date
1 A 1/1/2011 1/6/2011
1 A 2/1/2011 2/4/2011
1 B 1/1/2010 1/2/2010
1 B 5/3/2010 5/6/2010
2 C 1/2/2011 1/5/2011
2 C 3/3/2011 3/4/2011
2 A 3/4/2010 3/5/3010
3 A 2/1/2011 2/1/2011
3 A 1/15/2010 1/17/2010
4 A 3/2/2010 3/5/2010
4 B 4/2/2010 4/2/2010
I want to transform the dataset as follows:
patient_ID drug drug_use_date
1 A 1/1/2011
1 A 1/2/2011
1 A 1/3/2011
1 A 1/4/2011
1 A 1/5/2011
1 A 1/6/2011
1 A 2/1/2011
1 A 2/2/2011
1 A 2/3/2011
1 A 2/4/2011
1 B 1/1/2010
1 B 1/2/2010
1 B 5/3/2010
1 B 5/4/2010
1 B 5/5/2010
1 B 5/6/2010
2 C 1/2/2011
2 C 1/3/2011
2 C 1/4/2011
2 C 1/5/2011
2 C 3/3/2011
2 C 3/4/2011
2 A 3/4/2010
2 A 3/5/2010
3 A 2/1/2011
3 A 1/15/2010
3 A 1/16/2010
3 A 1/17/2010
4 A 3/2/2010
4 A 3/3/2010
4 A 3/4/2010
4 A 3/5/2010
4 B 4/2/2010
in the above dataset, all the drug use date are laid out day by day from the
drug start date till drug end date from the original dataset.
Would you please help to transform from the original dataset to the above
one? Many thanks,
l*******s
发帖数: 6
2
proc sort data=a;
by patient_id drug drug_start_date;
run;
data b;
set a;
by patient_id drug drug_start_date;
do drug_use_date=drug_start_date to drug_end_date by 1;
output;
end;
format drug_use_date mmddyy10.;
run;
1 (共1页)
进入Statistics版参与讨论
相关主题
SAS 问题
PROC SQL join data help
[求助]count coverage days
请教一个sas的sort date变量问题
发包子求大牛解SAS问题,急
SAS Question
Dataset merge的一个问题
[SAS]怎么快捷地删除Macro 里创建的临时dataset和macro variab
请教一个UNIX下面用SAS的弱智问题
问个效率问题 SQL vs data step,大数据量
相关话题的讨论汇总
话题: 2010话题: 2011话题: drug话题: date话题: dataset