Thursday, May 24, 2012

To flag Baseline records

As an example, the Baseline value for one assessment here is defined as the last non-missing measurement taken on or before the day of the first dosing of study drug.

Different programmers use different approaches to flag Baseline records. I used two steps (using LB domain in SDTM as an example):
1) To sort the assessment results in dataset LB througth PROC SORT by subject assessment date_time...;

PROC SORT DATA=lb;
  BY usubjid lbcat lbscat lbtestcd DESCENDING lbdtc;
RUN;

2) To flag the Baseline value with ABLFL='Y'.

 DATA lb(drop=flag); ** drop the temporary variable **;
  SET lb;
  BY usubjid lbcat lbscat lbtestcd DESCENDING lbdtc;
   ** variable flag is used to identify if one test has ABLFL marked **;
  RETAIN flag;
   ** flag=0 indicating there is no ABLFL marked yet. **; 
  IF first.lbtestcd THEN flag=0;
  ** you can add more conditions in IF logic expressions. **;
  ** TRTSDT below has the first dosing dates. **;
  IF flag=0 and LBDT <= TRTSDT and LBSTRESN ne .THEN DO;
    ABLFL='Y'; ** ABLFL='Y' indicates the baseline record. **;
    flag=1; ** flag=1 indicating the ABLFL is marked. **;
  END;
RUN; 
 

7 comments:

  1. If the same has to be done on Vital signs data where height has been recorded only on first visit i.e @ screening but not in run in period???????

    ReplyDelete
    Replies
    1. The codes above don't exclude any test, so all test will be flagged, including HEIGHT. If you don't want to flag HEIGHT, just add " and VSTESTCD ne 'HEIGHT' " to the conditions of flagging ABLFL.

      Delete
    2. Is there a sample data set on which we can tryout this code?

      Delete
  2. how to handle cases where the --STDTC is an incomplete date field?

    ReplyDelete
  3. in case treatment visit (after baseline visit) meeting the criteria and not baseline visit, do we still flagged as baseline flag?

    ReplyDelete
  4. good
    <a href="http://spunksoft.com/course/clinical-sas-training-in-hyderabad/>clinical sas training in Hyderabad</a>

    ReplyDelete
  5. please help how to derive LBBLFL flage in labdata

    ReplyDelete