As with almost any task in SAS, there are multiple techniques available to assign CTC grades. Part of what makes implementation difficult is the variety in the criteria themselves. As mentioned above, some are based on fixed values, others are multiples of normal range criteria (which can change from study to study and even from patient to patient), and still others are a combination of the two. The way the criteria vary make it impossible to simply enter values into a database and apply them as needed. It is possible to write “fancy” code to implement these criteria, however there are several issues with using complicated code for this exercise.
In many cases, complex code is more likely to be adversely affected by changes in the data and produce unreliable results. If issues do arise, it is often more difficult to trace the source of the problem and subsequently to fix it. This difficulty is compounded if the programmer who originally created the program is not available to diagnose and fix the problem. In addition, complex code generally requires a senior-level resource to produce and maintain. If the system developed is complex enough, even senior resources need to be trained on that system or take a significant amount of time to work through the logic of the programs for themselves. While simple code is not as impressive, experience with several approaches has shown that the simple approach can be the most efficient way to apply CTC criteria. One example of a simple approach to assigning CTC criteria for three tests (calcium, creatinine, and platelets) is presented below. The key variables in the labs data set are as follows: lbtest contains the name of the laboratory test, lbstresn contains the laboratory result in standard units, lbstresu contains the name of the unit for lbstresn, lbstnrlo is the lower bound of the normal range and lbstnrhi is the upper bound of the normal range. Lbstresn, lbstnrlo and lbstnrhi are all numeric variables reporting values in the same unit (as indicated by lbstresu). Lbtoxgr is the name of the variable that will contain the CTC grade.
data labs ;
set inlib.labs ;
/**----- CALCIUM -----**/
if lbtest = "Calcium" then
do ;
if nmiss(lbstnrhi, lbstnrlo) eq 0 then
do ;
if (lbstresn ge lbstnrlo) and (lbstresn le lbstnrhi) then lbtoxgr =0;
else if (lbstresn ge 8) and (lbstresn lt lbstnrlo) then lbtoxgr =1;
else if (lbstresn gt lbstnrhi) and (lbstresn le 11.5) then lbtoxgr =1;
end ;
else if lbstnrhi gt .z and lbstnrlo le .z then
do ;
if (lbstresn ge 8) and (lbstresn lt lbstnrlo) then lbtoxgr =1;
else if (lbstresn gt lbstnrhi) and (lbstresn le 11.5) then lbtoxgr =1;
end ;
else if lbstnrlo gt .z and lbstnrhi le .z then
do ;
if (lbstresn ge 8) and (lbstresn lt lbstnrlo) then lbtoxgr = 1 ;
end ;
if lbtoxgr eq . then
do ;
if (lbstresn ge 7) and (lbstresn lt 8) then lbtoxgr = 2 ;
else if (lbstresn gt 11.5) and (lbstresn le 12.5) then lbtoxgr = 2 ;
else if (lbstresn ge 6) and (lbstresn lt 7) then lbtoxgr = 3 ;
else if (lbstresn gt 12.5) and (lbstresn le 13.5) then lbtoxgr = 3 ;
else if (lbstresn lt 6) then lbtoxgr = 4 ;
else if (lbstresn gt 13.5) then lbtoxgr = 4 ;
end ;
end ;
/*----- CREATININE -----*/
else if lbtest = "Creatinine" then
do ;
if lbstnrhi gt .z then
do ;
if (lbstresn le lbstnrhi) then lbtoxgr = 0 ;
else if (lbstresn gt lbstnrhi) and
(lbstresn le (1.5*lbstnrhi)) then lbtoxgr = 1 ;
else if (lbstresn gt (lbstnrhi*1.5)) and
(lbstresn le (3*lbstnrhi)) then lbtoxgr = 2 ;
else if (lbstresn gt (lbstnrhi*3)) and
(lbstresn le (6*lbstnrhi)) then lbtoxgr = 3 ;
else if (lbstresn gt (lbstnrhi*6)) then lbtoxgr = 4 ;
end ;
end ;
/*----- PLATELETS -----*/
else if lbtest = "Platelet Count" then
do ;
if lbstnrlo gt .z then
do ;
if (lbstresn ge lbstnrlo) then lbtoxgr = 0 ;
else if (lbstresn ge 75) and (lbstresn lt lbstnrlo) then lbtoxgr = 1 ;
else if (lbstresn ge 50) and (lbstresn lt 75) then lbtoxgr = 2 ;
else if (lbstresn ge 25) and (lbstresn lt 50) then lbtoxgr = 3 ;
else if (lbstresn lt 25) then lbtoxgr = 4 ;
end ;
else
do ;
if (lbstresn ge 50) and (lbstresn lt 75) then lbtoxgr = 2 ;
else if (lbstresn ge 25) and (lbstresn lt 50) then lbtoxgr = 3 ;
else if (lbstresn lt 25) then lbtoxgr = 4 ;
end ;
end ;
run ;
Programs that implement the coding method above can get large. However, it is important to note that CTC criteria do not change often. Because of this, it is possible to reuse the code above across many studies with minimal changes. It is also possible to facilitate the reuse of this code through the use of macros or simply creating a master program template that contains the code for all CTC criteria, then copy and paste from the master program into specific study programs. While the simplicity of the code above may make it seem that applying CTC criteria is simple, there are many issues surrounding this process that can quickly make the code more complicated.