BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hsas
Calcite | Level 5

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,

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

View solution in original post

7 REPLIES 7
LinusH
Tourmaline | Level 20
Sorry, but what are you talking about?
Data never sleeps
Reeza
Super User

Is this in SAS Clinical?

Hsas
Calcite | Level 5

Yes in SDTM clinical SAS.

Reeza
Super User

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 🙂

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

sas-innovate-2024.png

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.

 

Register now!

New Learning Events in April

 

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.

LEARN MORE

Discussion stats
  • 7 replies
  • 3001 views
  • 1 like
  • 4 in conversation