CTCAE grading for lab

Reply
Contributor
Posts: 25

CTCAE grading for lab

Hi,

Need help to create macro for CTCT AE grading for lab. I am new to this. I tried to follow the coding I got from site http://www.mwsug.org/proceedings/2011/coders/MWSUG-2011-CC10.pdf( I liked the code)

but giving me lot of errors...  as an input I used following files .  I need help with how the excel values to be entered based on CTCAE 4.03. I created CTC_GRAD.xlsx with only 'ALB' with the sample from the site.

I want to use this code as macro since we are taking the values from excel.

Its very urgent!!  any help is greatly appreciated...  I have only one week to finish this

my code:

DATA _NULL_;

    SET CTC_GRAD END = EOF;

    LENGTH CODELINE $200;

  

    IF PARNAME ^='' AND GRADE ^= . AND (LOW_VAL ^= . OR UPP_VAL ^= .)THEN DO;

    ELSE PUT '**** WARNING: INCOMPLETE METADATA OBSERVATION ****';

    IF _N_ = 1 THEN DO;

        CALL EXECUTE('DATA LABCTC;');

        CALL EXECUTE(' SET LAB;');

        CALL EXECUTE(' SELECT;');

    END;

  

  IF LOW_VAL ^= . THEN DO;

    SELECT( UPCASE( LOW_REF ));

        WHEN('LNR') LOW_LIM = PUT(LOW_VAL, BEST12.) || '* LBSTNRLO';

        WHEN('UNR') LOW_LIM = PUT(LOW_VAL, BEST12.) || '* LBSTNRHI';

        WHEN('') LOW_LIM = PUT(LOW_VAL, BEST12.);

        OTHERWISE LOW_LIM = '';

    END;

  END;

  ELSE LOW_LIM = '';

  IF UPP_LIM ^= '' OR LOW_LIM ^= '' THEN DO;

    CODELINE = '    WHEN(LBTESTCD= "'||STRIP(PARNAME)||'" AND LBSTRESU="'||STRIP(UNITS)||'" AND ';

      IF LOW_VAL ^= . AND LOW_COMP ^= '' THEN CODELINE = STRIP(CODELINE) || ' LBSTRESN ' || STRIP(LOW_COMP) || STRIP(LOW_LIM);

    IF LOW_VAL ^= . AND LOW_COMP ^= '' AND UPP_VAL ^= . AND UPP_COMP ^= '' THEN CODELINE = STRIP(CODELINE) ||' AND ';

    IF UPP_VAL ^= . AND UPP_COMP ^= '' THEN CODELINE = STRIP(CODELINE) || ' LBSTRESN ' || STRIP(UPP_COMP) || STRIP(UPP_LIM);

    IF LOW_REF = 'LNR' OR UPP_REF = 'LNR' THEN CODELINE = STRIP(CODELINE) || ' AND LBSTNRLO ^= . ';

    IF LOW_REF = 'UNR' OR UPP_REF = 'UNR' THEN CODELINE = STRIP(CODELINE) || ' AND LBSTNRHI ^= . ';

    CODELINE = STRIP(CODELINE) || ' AND LBSTRESN ^= . ) CTC_1C = ' || STRIP( PUT( GRADE, BEST12. )) || ';';

  CALL EXECUTE( CODELINE );

  END;

  IF EOF THEN DO;

    CALL EXECUTE(' OTHERWISE;');

    CALL EXECUTE(' END;');

    CALL EXECUTE('RUN;');

    END;

RUN;

Attachment
Attachment
Super User
Posts: 11,343

Re: CTCAE grading for lab

You should indicate the type of errors you are gettting, copy from the SAS log would be best so we have a chance to see which code is throwing which error.

Contributor
Posts: 25

Re: CTCAE grading for lab

My error log: after commenting out the following code:

/*IF PARNAME ^='' AND GRADE ^= . AND (LOW_VAL ^= . OR UPP_VAL ^= .)THEN DO;

    ELSE PUT '**** WARNING: INCOMPLETE METADATA OBSERVATION ****'; */ Throwing error here too  because nothing after then do;

NOTE: Variable UPP_LIM is uninitialized.

NOTE: There were 4 observations read from the data set CTLB.CTC_GRAD.

NOTE: DATA statement used (Total process time):

      real time           0.02 seconds

      cpu time            0.04 seconds

NOTE: CALL EXECUTE generated line.

1   + DATA LABCTC;

2   +  SET LAB;

3   +  SELECT;

4   + WHEN(LBTESTCD= "ALB" AND LBSTRESU="g/L" AND LBSTRESN <=1* LBSTNRLO AND LBSTNRLO ^= . AND

LBSTRESN ^= . ) CTC_1C = 0;

NOTE: Line generated by the CALL EXECUTE routine.

5   + WHEN(LBTESTCD= "ALB" AND LBSTRESU="g/L" AND LBSTRESN <=30 AND LBSTRESN < AND LBSTRESN ^= . )

                                                                                   --------

                                                                                   22

5  !+ CTC_1C = -1;

NOTE: Line generated by the CALL EXECUTE routine.

6   + WHEN(LBTESTCD= "ALB" AND LBSTRESU="g/L" AND LBSTRESN <=20 AND LBSTRESN < AND LBSTNRLO ^= .

                                                                                   --------

                                                                                   22

6  !+AND LBSTRESN ^= . ) CTC_1C = -2;

NOTE: Line generated by the CALL EXECUTE routine.

7   + WHEN(LBTESTCD= "ALB" AND LBSTRESU="g/L" AND LBSTRESN <0 AND LBSTRESN < AND LBSTRESN ^= . )

                                                                                 --------

                                                                                 22

7  !+CTC_1C = -3;

ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, ',', -, /, <,

              <=, <>, =, >, ><, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR,

              [, ^=, {, |, ||, ~=.

8   +  OTHERWISE;

9   +  END;

10  + RUN;

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.LABCTC may be incomplete.  When this step was stopped there were 0

         observations and 37 variables.

NOTE: DATA statement used (Total process time):

Super User
Posts: 11,343

Re: CTCAE grading for lab

First, I would address this by adding an End; after the Do; IF PARNAME ^='' AND GRADE ^= . AND (LOW_VAL ^= . OR UPP_VAL ^= .)THEN DO; 

    ELSE PUT '**** WARNING: INCOMPLETE METADATA OBSERVATION ****';

I'm not sure, but it looks like  the < AND may be missing a value in the line below. What is LBSTRESN supposed to be less than?

LBSTRESN <=30 AND LBSTRESN < AND LBSTRESN

You might try the condition

. < LBSTRESN <= 30

instead of multiple AND operators. You may have an issue with resolution as the AND are evaluated left to right and you may actually want to force some as group to evaluate first.

These lines also have "LBSTRESN < AND" which really looks problematic.

AND LBSTRESN <=20 AND LBSTRESN < AND LBSTNRLO ^=

AND LBSTRESN <0 AND LBSTRESN < AND LBSTRESN ^= .

Trusted Advisor
Posts: 1,137

Re: CTCAE grading for lab

I checked the CTC_GRD.csv file and i observed that low_comp and upp_comp both have less than sign (<= or <), instead i believe it should have been low_comp as >= and UPP_comp as <.

could you check this

Thanks,
Jag
Trusted Advisor
Posts: 1,137

Re: CTCAE grading for lab

i made few changes to the existing code, could you please run and check if this is producing the desired output. There are no errors

proc import datafile='~\CTC_GRADcsv.csv' out=ctc dbms=csv replace;

run;

proc import datafile='~\lab.csv' out=lab dbms=csv replace;

run;

data lab_;

    set lab;

PARNAME=LBTESTCD;

UNITS=LBSTRESU;

LABRES=LBSTRESN;

LABLLN=LBSTNRLO;

LABULN=LBSTNRHI;

run;

DATA _NULL_;

SET CTC END = EOF;

LENGTH CODELINE $200;

IF PARNAME ^='' AND GRADE ^= . AND (LOW_VAL ^= . OR UPP_VAL ^= .) then output;

ELSE PUT "**** WARNING: INCOMPLETE METADATA OBSERVATION ****";

IF _N_ = 1 THEN DO;

CALL EXECUTE('DATA LABCTC;');

CALL EXECUTE(' SET LAB_;');

CALL EXECUTE(' SELECT;');

END;

IF LOW_VAL ^= . THEN DO;

SELECT( UPCASE( LOW_REF ));

WHEN('LNR') LOW_LIM = PUT(LOW_VAL, BEST12.) || '* LABLLN';

WHEN('UNR') LOW_LIM = PUT(LOW_VAL, BEST12.) || '* LABULN';

WHEN('') LOW_LIM = PUT(LOW_VAL, BEST12.);

OTHERWISE LOW_LIM = '';

END;

END;

ELSE LOW_LIM = '';

IF /*UPP_LIM ^= '' OR*/ LOW_LIM ^= '' THEN DO;

CODELINE = ' WHEN(PARNAME="'||STRIP(PARNAME)||'" AND UNITS="'||STRIP(UNITS)||'" AND ';

IF LOW_VAL ^= . AND LOW_COMP ^= '' THEN

CODELINE = STRIP(CODELINE) ||' LABRES ' || STRIP(LOW_COMP) ||STRIP(LOW_LIM);

IF LOW_VAL ^= . AND LOW_COMP ^= '' AND UPP_VAL ^= . AND UPP_COMP ^= '' THEN

CODELINE = STRIP(CODELINE) /*||' AND '*/;

IF UPP_VAL ^= . AND UPP_COMP ^= '' THEN

CODELINE = STRIP(CODELINE) /*|| ' LABRES ' || STRIP(UPP_COMP) ||STRIP(UPP_LIM)*/;

IF LOW_REF = 'LNR' OR UPP_REF = 'LNR' THEN

CODELINE = STRIP(CODELINE) || ' AND LABLLN ^= . ';

IF LOW_REF = 'UNR' OR UPP_REF = 'UNR' THEN

CODELINE = STRIP(CODELINE) || 'AND LABULN ^= . ';

CODELINE = STRIP(CODELINE) || ' AND LABRES ^= . ) CTC_1C = ' ||STRIP( PUT( GRADE, BEST12. )) || ';';

CALL EXECUTE( CODELINE );

end;

IF EOF THEN DO;

CALL EXECUTE(' OTHERWISE;');

CALL EXECUTE(' END;');

CALL EXECUTE('RUN;');

END;

RUN;

Thanks,

Jag

Thanks,
Jag
Occasional Contributor
Posts: 5

Re: CTCAE grading for lab

Dear Mimi and all,

Sorry I know this does not fit here in this technical forum.

Could you help me understand the basic purpose of CTCAE grades. I have been through different papers literature on internet but I could not find the exact need of it in one line.. Basically, I would like to make a really really junior SAS programmer understand the basic purpose for him to remember one line.. without giving too many details but when exactly we go for it, when it comes into picture - just a precise point.

My understanding so far is something like -

The reference ranges [the Upper Limit of Normal [ULN] and Lower Limit of Normal (LLN)] in lab data, with this one can identify whether the
resulting value of the lab test is normal i.e. within range or abnormal i.e. out of range. However, we need to further see the abnormal values to find if this abnormality is clinically significant i.e. notable abnormalities which could potentially be reported as an adverse event.

Could you please help me understand. Many thanks for your inputs in advance.

I know its not a technical question but more of a domain. Look forward to your responses.

regards,

GSP

Occasional Contributor
Posts: 5

Re: CTCAE grading for lab

I am basically confused with AE and LAB data in CTCAE grading. I am not able to put this together and make it easy for Junior programmers.

Thanks all.

GSP

Ask a Question
Discussion stats
  • 7 replies
  • 1363 views
  • 0 likes
  • 4 in conversation