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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2929 views
  • 1 like
  • 4 in conversation