Hi,
How to populate --TESTCD for the NOT DONE records in an SDTM dataset. eg.
in VS dataset per subject if there are 5 parameters out of which if one is not done then the TESTCD should be of that parameter and VSSTAT=NOT DONE. However for this visit if all parameters are NOT DONE then the entire panerfor that visit per subject should be collapsed to 1record with VSTESTCD=VSALL. How can this be done using SAS? Please help.
Thanks,
Well, if you can code its pretty simple:
data have; length usubjid vstestcd vsstatus $20; usubjid="001"; vstestcd="PULSE"; vsstatus=""; output; usubjid="001"; vstestcd="HEIGHT"; vsstatus=""; output; usubjid="002"; vstestcd="PULSE"; vsstatus="NOT DONE"; output; usubjid="002"; vstestcd="HEIGHT"; vsstatus="NOT DONE"; output; run; proc sql; create table WANT as select * from HAVE where USUBJID not in (select distinct USUBJID from (select * from HAVE where VSSTATUS="NOT DONE") group by USUBJID having count(*)=2) union all select distinct USUBJID, "VSALL" as VSTESTCD, VSSTATUS from HAVE where USUBJID in (select distinct USUBJID from (select * from HAVE where VSSTATUS="NOT DONE") group by USUBJID having count(*)=2); quit;
Obviously change it to match your data.
Is this in SAS Clinical?
Yes in SDTM clinical SAS.
I've moved your post to the Healthcare forum. That said there aren't a lot of people who use this particular application on here.
I would highly recommend contacting SAS Tech Support. That's what you pay them for after all 🙂
ok thank you.
Well, if you can code its pretty simple:
data have; length usubjid vstestcd vsstatus $20; usubjid="001"; vstestcd="PULSE"; vsstatus=""; output; usubjid="001"; vstestcd="HEIGHT"; vsstatus=""; output; usubjid="002"; vstestcd="PULSE"; vsstatus="NOT DONE"; output; usubjid="002"; vstestcd="HEIGHT"; vsstatus="NOT DONE"; output; run; proc sql; create table WANT as select * from HAVE where USUBJID not in (select distinct USUBJID from (select * from HAVE where VSSTATUS="NOT DONE") group by USUBJID having count(*)=2) union all select distinct USUBJID, "VSALL" as VSTESTCD, VSSTATUS from HAVE where USUBJID in (select distinct USUBJID from (select * from HAVE where VSSTATUS="NOT DONE") group by USUBJID having count(*)=2); quit;
Obviously change it to match your data.
Thank you.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.