t**i 发帖数: 688 | 1 Suppose the data for subject #101 is as follows:
ID Date Time Event Glucose
101 01Jan2000 7:30 Sampling .
101 01Jan2000 8:00 Dosing .
101 01Jan2000 8:30 Sampling 100
101 01Jan2000 9:30 Sampling 200
101 01Jan2000 12:30 Sampling 170
101 01Jan2000 18:30 Sampling 140
101 02Jan2000 7:30 Sampling 90
101 02Jan2000 8:00 Dosing .
101 03Jan2000 8:00 Dosing .
101 04Jan2000 8:00 Dosing .
101 05Jan2000 8:00 Dosing .
101 05Jan2000 8:30 Sampling 100
101 05 |
d*******1 发帖数: 854 | 2 你的问题倒是很具体详细, 就是太难懂了, 能耐下心来读懂的不多, 最好把这个大
问题分割成几个小问题来问。
【在 t**i 的大作中提到】 : Suppose the data for subject #101 is as follows: : ID Date Time Event Glucose : 101 01Jan2000 7:30 Sampling . : 101 01Jan2000 8:00 Dosing . : 101 01Jan2000 8:30 Sampling 100 : 101 01Jan2000 9:30 Sampling 200 : 101 01Jan2000 12:30 Sampling 170 : 101 01Jan2000 18:30 Sampling 140 : 101 02Jan2000 7:30 Sampling 90 : 101 02Jan2000 8:00 Dosing .
|
t**i 发帖数: 688 | 3 Question: in SAS Data Step, is there a way to refer to future records? I
think not, but would like to have it confirmed. |
y*m 发帖数: 102 | 4 not easy, better sort it by desending order, then do it backwards.
after done, sort it back
or from my previous experience, addl can be calculated by expanding all the
dates in a CDP(constant dosing period), of course you 'll have to know the
start date and end date of each CDP.
【在 t**i 的大作中提到】 : Question: in SAS Data Step, is there a way to refer to future records? I : think not, but would like to have it confirmed.
|
d*******1 发帖数: 854 | 5 yes, remember SAS holds a record in RAM AT A TIME. So in reality SAS would
not remember the previous records nor foresee the upcoming records unless
special techniques are used (R knows all since everything in RAM).
refering to the "future"records can not be done in a single data step. You
either need to create two datasets and merge them ("current records" from
dataset1 match to "future" records from dataset2) or assign the "future"
records to macro variable in the first data step and later on
【在 t**i 的大作中提到】 : Question: in SAS Data Step, is there a way to refer to future records? I : think not, but would like to have it confirmed.
|
y*m 发帖数: 102 | 6 I guess I am too bored today,
here is the solution, baozi is very welcome .I added some data to make it
more realistic.
data temp;
input ID $ Date $9. Time $ Event $ Glucose;
time=put(input(time,time5.),tod5.);
cards;
101 01Jan2000 7:30 Sampling .
101 01Jan2000 8:00 Dosing .
101 01Jan2000 8:30 Sampling 100
101 01Jan2000 9:30 Sampling 200
101 01Jan2000 12:30 Sampling 170
101 01Jan2000 18:30 Sampling 140
101 02Jan2000 7:30 Sampling 90
101 02Jan2000 8:00 Do
【在 t**i 的大作中提到】 : Question: in SAS Data Step, is there a way to refer to future records? I : think not, but would like to have it confirmed.
|
p********a 发帖数: 5352 | 7 赞楼上。。。Good programming skills |
i**f 发帖数: 1195 | 8 不用看文字,看data就好了
把data1的格式变成data2,加上ADDL和II(additional dose的数量和dosing interval)
data1
D Date Time Event Glucose
101 01Jan2000 7:30 Sampling .
101 01Jan2000 8:00 Dosing .
101 01Jan2000 8:30 Sampling 100
101 01Jan2000 9:30 Sampling 200
101 01Jan2000 12:30 Sampling 170
101 01Jan2000 18:30 Sampling 140
101 02Jan2000 7:30 Sampling 90
101 02Jan2000 8:00 Dosing .
101 03Jan2000 8:00 Dosing .
101 04Jan2000 8:00 Dosing .
101 05Jan2000 8:00 Dosing .
data2
【在 d*******1 的大作中提到】 : yes, remember SAS holds a record in RAM AT A TIME. So in reality SAS would : not remember the previous records nor foresee the upcoming records unless : special techniques are used (R knows all since everything in RAM). : refering to the "future"records can not be done in a single data step. You : either need to create two datasets and merge them ("current records" from : dataset1 match to "future" records from dataset2) or assign the "future" : records to macro variable in the first data step and later on
|
t**i 发帖数: 688 | 9 What if some of dosing records that are not accompanied with blood sampling
events are missing?
【在 y*m 的大作中提到】 : I guess I am too bored today, : here is the solution, baozi is very welcome .I added some data to make it : more realistic. : data temp; : input ID $ Date $9. Time $ Event $ Glucose; : time=put(input(time,time5.),tod5.); : cards; : 101 01Jan2000 7:30 Sampling . : 101 01Jan2000 8:00 Dosing . : 101 01Jan2000 8:30 Sampling 100
|
A*******s 发帖数: 3942 | 10 问问,为啥result data里那个addl是3而不是4呢?后面不是跟了4个dosing的
observation么?
哦,明白了。同一天之后有sampling的不算进addl里面。眼拙了
【在 t**i 的大作中提到】 : Suppose the data for subject #101 is as follows: : ID Date Time Event Glucose : 101 01Jan2000 7:30 Sampling . : 101 01Jan2000 8:00 Dosing . : 101 01Jan2000 8:30 Sampling 100 : 101 01Jan2000 9:30 Sampling 200 : 101 01Jan2000 12:30 Sampling 170 : 101 01Jan2000 18:30 Sampling 140 : 101 02Jan2000 7:30 Sampling 90 : 101 02Jan2000 8:00 Dosing .
|
|
|
t**i 发帖数: 688 | 11 When a dosing event/record is accompanied with its corresponding sampling
records, then that dosing record should not be counted toward ADDL. |
A*******s 发帖数: 3942 | 12 有个细节还不明白,比如说yOm大牛贴出来的那个dataset
101 01Jan2000 7:30 Sampling .
101 01Jan2000 8:00 Dosing .
101 01Jan2000 8:30 Sampling 100
101 01Jan2000 9:30 Sampling 200
101 01Jan2000 12:30 Sampling 170
101 01Jan2000 18:30 Sampling 140
101 02Jan2000 7:30 Sampling 90
101 02Jan2000 8:00 Dosing .
101 03Jan2000 8:00 Dosing .
101 04Jan2000 8:00 Dosing .
101 05Jan2000 8:00 Dosing .
101 05Jan2000 8:30 Sampling 100
101 05Jan2000 9:30 Sampling 200
101 05Jan2000 12:30 Samplin
【在 t**i 的大作中提到】 : When a dosing event/record is accompanied with its corresponding sampling : records, then that dosing record should not be counted toward ADDL.
|
y*m 发帖数: 102 | 13 then there has to be some variable indicating that, I don't see any variable
like that here?
sampling
【在 t**i 的大作中提到】 : What if some of dosing records that are not accompanied with blood sampling : events are missing?
|
y*m 发帖数: 102 | 14 1) i think not, 'cause there's 06Jan2000 in between without a dosing
2) it was included in my code, 08jan2000 is additional dose for 07jan2000
sampling
【在 A*******s 的大作中提到】 : 有个细节还不明白,比如说yOm大牛贴出来的那个dataset : 101 01Jan2000 7:30 Sampling . : 101 01Jan2000 8:00 Dosing . : 101 01Jan2000 8:30 Sampling 100 : 101 01Jan2000 9:30 Sampling 200 : 101 01Jan2000 12:30 Sampling 170 : 101 01Jan2000 18:30 Sampling 140 : 101 02Jan2000 7:30 Sampling 90 : 101 02Jan2000 8:00 Dosing . : 101 03Jan2000 8:00 Dosing .
|
t**i 发帖数: 688 | 15 To yOm:
After ADDL is obtained, those dosing records that has been counted as part
of ADDL should be deleted. Your code did not do that.
To yOm and Actuaries:
06Jan2000 is a sampling corresponding to the dosing on 05Jan2000. The
records on 07Jan2000 and 08Jan2000 were added by yOm, which do not
necessarily abide the rule of the data set.
Let's concentrate on the data from 01Jan2000 to 06Jan2000.
Essentially, there may be a number of sampling events (the ones on 01Jan2000
and 05Jan2000) follow |
t**i 发帖数: 688 | 16 There may not be a variable indicating this in the data set to begin with.
However, such information has to be obtained/created in the process of
calculating ADDL.
Let's concentrate on the original example dataset for the time being and
complete it.
variable
【在 y*m 的大作中提到】 : then there has to be some variable indicating that, I don't see any variable : like that here? : : sampling
|
y*m 发帖数: 102 | 17 really, have you checked my final output dataset, the date from 02jan
through 04jan should have been deleted.
01Jan2000
if
【在 t**i 的大作中提到】 : To yOm: : After ADDL is obtained, those dosing records that has been counted as part : of ADDL should be deleted. Your code did not do that. : To yOm and Actuaries: : 06Jan2000 is a sampling corresponding to the dosing on 05Jan2000. The : records on 07Jan2000 and 08Jan2000 were added by yOm, which do not : necessarily abide the rule of the data set. : Let's concentrate on the data from 01Jan2000 to 06Jan2000. : Essentially, there may be a number of sampling events (the ones on 01Jan2000 : and 05Jan2000) follow
|
y*m 发帖数: 102 | 18 i don't see any missing dosing date in the original data as well?
or maybe 06jan without dosing row imply the dosing is missing?
【在 t**i 的大作中提到】 : There may not be a variable indicating this in the data set to begin with. : However, such information has to be obtained/created in the process of : calculating ADDL. : Let's concentrate on the original example dataset for the time being and : complete it. : : variable
|
t**i 发帖数: 688 | 19 The sampling on 06Jan2000 was corresponding to the dosing on 05Jan2000. The
II is 24 hours, so the sampling outside of a window of 24 hours after a
dosing event could indicate a missing dose unless otherwise explicitly
indicated as 36, 48 or 96 hours sampling events, etc. I did not include
such cases in my example.
In my original example dataset, I did not make any missing values. I wanted
to begin with the simplest scenario :-)
【在 y*m 的大作中提到】 : i don't see any missing dosing date in the original data as well? : or maybe 06jan without dosing row imply the dosing is missing? : :
|
t**i 发帖数: 688 | 20 My mistake.
Your code does have those ADDL dosing records removed.
【在 y*m 的大作中提到】 : really, have you checked my final output dataset, the date from 02jan : through 04jan should have been deleted. : : 01Jan2000 : if
|