no worries. I gave you new code. Please see if the new screenshot matches your desired output. I did not understand your requirement initially. Apologies.
Perfect.... thank you very much @tarheel13 .
please don't mind if I bother you again incase I stuck up 🙂
Thank you again.
haha it's never a bother! I learn so much on this forum!
My supervisor has another bizarre request with RANK value in this data 😞
This is how we develop RANK value up till now. but my client need highlighted value for obs. 7 and 8 as 5 and not 1
like this...
Reason: He says...while deriving RANK value for obs. 7, he wanted to check latest of LLT = urea value, which is obs. no. 4 and AENDT of obs. no. 4 is not equal to ASTDT of obs. no. 7, so we need to keep adding RANK +1.
currently while deriving RANK value for obs. 7, we are considering obs. no. 3.
can we modify our existing code for this requirement.
sorry to trouble you with this again.
I am also attaching the datalines for this.
data test;
input @1 usubjid $3.
@5 ae $8.
@14 llt $8.
@23 astdt date9.
@33 aendt date9.
;
format astdt aendt date9.;
datalines;
410 amino alan 19JUL2022 08AUG2022
410 amino aspar 01AUG2022 08AUG2022
410 Toxicity urea 26JUL2022 18AUG2022
410 Toxicity urea 02AUG2022 15AUG2022
410 Toxicity prot 08AUG2022 21SEP2022
410 Toxicity creat 11AUG2022 22AUG2022
410 Toxicity urea 18AUG2022 18AUG2022
410 Toxicity urea 18AUG2022 02SEP2022
410 Toxicity minuria 29AUG2022 21SEP2022
410 Toxicity urea dec 15SEP2022 21SEP2022
720 Toxicity estim 27DEC2022 17JAN2023
720 Toxicity urea 03JAN2023 17JAN2023
720 Toxicity creat 10JAN2023 24JAN2023
720 Toxicity estim 17JAN2023 28FEB2023
720 Toxicity urea 31JAN2023 14FEB2023
720 Toxicity creat 31JAN2023 14FEB2023
720 Toxicity urea 21FEB2023 28FEB2023
720 Toxicity estim 28FEB2023 21MAR2023
;
run;
sorry I don't know how to do that. I would suggest maybe making a new thread with the new requirement. since a solution was already accepted on this thread, there is no chance for another SAS user to have their solution accepted. I think @Kurt_Bremser probably knows hash object better than me anyway.
Can you explain WHAT is the medical significance of this calculation? What are you trying to "count" or "rank"? Are you trying to collapse the conflicting date ranges into a single contiguous range? Are you trying to collapse multiple different reported terms into a single record based on the coded Lowest Level Term from the MEDDRA vocabulary?
Do you really need all of the records back out? Or would it be better to just collapse them?
How did you collect this data? Why do you have overlapping AE dates for the same AE term? Are you sure that all events with overlapping dates can/should be collapsed? What if they got stung by two different bees?
Normally when you collect adverse events from patients (or their doctors) you get a start date and either an end date or an indication that the AE is ongoing. Do you have the ONGOING flag for the individual records?
If you collected the data some other way (examining records or billing data perhaps?) then it is more likely you will multiple reports of the same event with conflicting or date ranges that need to be consolidated.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.