Dear,
I need assign a base line flag based on wheather or not a treatment date available. Please help
For ID=1, I am able assign baseline flag as trtdate available.
For ID=2, I need to subset all the OBS that have date1 value less than min(date1 value) when epoch=' DOUBLE BLIND WITHDRAWAL'. I can write a simple code to subset the dateset. eg. "if epoch ^= 'DOUBLE BLIND WITHDRAWAL ' or epoch ^= 'FOLLOW-Up '. Bu this did not help me as there are other EPOCH values and large dataset. So, I need to subset based 'date1' values.
Please help
data
id test date1 epoch trtdate
1 diabp 2016-01-26 SCREENING 24MAR2016
1 diabp 2016-02-24 TITRATION 24MAR2016
1 diabp 2016-03-09 TITRATION 24MAR2016
1 diabp 2016-03-23 STABLE DOSE 24MAR2016
1 diabp 2016-04-05 DOUBLE BLIND WITHDRAWAL 24MAR2016
1 diabp 2016-04-08 DOUBLE BLIND WITHDRAWAL 24MAR2016
id test date1 epoch trtdate
2 diabp 2016-01-26 SCREENING
2 diabp 2016-02-24 TITRATION
2 diabp 2016-03-09 TITRATION
2 diabp 2016-03-23 STABLE DOSE
2 diabp 2016-04-05 DOUBLE BLIND WITHDRAWAL
2 diabp 2016-04-08 DOUBLE BLIND WITHDRAWAL
2 diabb 2016-05-08 FOLLOW-UP
2 diabb 2016-05-18 FOLLOW-UP
I think you may need to provide a bit more information. One thing is to provide an example of what the output should look like.
It isn't clear what type of values the flag should be character or numeric, or what the desired value may be. Also Is this looking for any treatment date at all within an ID or only for some value epoch within id? And what type of subset of Date1? Exactly that date only or within a time frame or?
I am sorry for that insufficient information. I am again including all the information.
I need to flag last dose before the start of epoch='DOUBLE BLIND WITHDRAWAL' dose( trtdate=28MAR2016.)
For ID=1, the output needed is BASEFL='Y' for 4 th OBS. as it is last test with (date1=2016-03-23) before 28MAR2016.
For ID=2, since the trtdate is not avialable, first I need to subset all the OBS with 'date1' values less than date1 values when epoch='DOUBLE BLIND WITHDRAWAL'. I need to subset first four OBS for ID=2, and then flag the last dose.
The output needed is BASEFL='Y' for 4 th OBS for ID=2
Thanks you very much for your time.
data
id test date1 epoch trtdate
1 diabp 2016-01-26 SCREENING 20FEB2016
1 diabp 2016-02-24 TITRATION 20MAR2016
1 diabp 2016-03-09 TITRATION 20MAR2016
1 diabp 2016-03-23 STABLE DOSE 22MAR2016
1 diabp 2016-04-05 DOUBLE BLIND WITHDRAWAL 28MAR2016
1 diabp 2016-04-08 DOUBLE BLIND WITHDRAWAL 28APR2016
id test date1 epoch trtdate
2 diabp 2016-01-26 SCREENING
2 diabp 2016-02-24 TITRATION
2 diabp 2016-03-09 TITRATION
2 diabp 2016-03-23 STABLE DOSE
2 diabp 2016-04-05 DOUBLE BLIND WITHDRAWAL
2 diabp 2016-04-08 DOUBLE BLIND WITHDRAWAL
2 diabb 2016-05-08 FOLLOW-UP
2 diabb 2016-05-18 FOLLOW-UP
@knveraraju91 wrote:
I am sorry for that insufficient information. I am again including all the information.
I need to flag last dose before the start of epoch='DOUBLE BLIND WITHDRAWAL' dose( trtdate=28MAR2016.)
For ID=1, the output needed is BASEFL='Y' for 4 th OBS. as it is last test with (date1=2016-03-23) before 28MAR2016.
For ID=2, since the trtdate is not avialable, first I need to subset all the OBS with 'date1' values less than date1 values when epoch='DOUBLE BLIND WITHDRAWAL'. I need to subset first four OBS for ID=2, and then flag the last dose.
The output needed is BASEFL='Y' for 4 th OBS for ID=2
Thanks you very much for your time.
What happens when the value epoch='DOUBLE BLIND WITHDRAWAL' never occurs for a specific ID?
What if there are not 4 dates before the epoch='DOUBLE BLIND WITHDRAWAL'?
Is it always exactly 4 dates? What if epoch='DOUBLE BLIND WITHDRAWAL' does not occur until the 7th record for an Id?
I actually am not seeing where TRDATE has anything to do with the rules. It looks like the value of Epoch is the only thing considered.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.