Hi Below, is the code to generate the SAS dataset. data TEST;
infile datalines dsd truncover;
input USUBJID:$22. PARAMCD:$8. PARAM:$200. AVAL:32. SEX:$1. AGE:32. AGELO:BEST9. AGEHI:BEST9. A1HI:BEST11. A2HI:BEST9. A3HI:BEST9. A4HI:BEST9. A1LO:BEST11. A2LO:BEST11. A3LO:BEST11. A4LO:BEST11. CTC_ALGORITHM:$176.;
datalines4;
1,CAF04C,SERUM Calcium (mg/dL),9.93987968,M,44,91,999,11.5,12.5,13.5,13.5,8,7,6,6,"If AVAL<8.2 then CTCTERM = ""Hypocalcemia""; Else if AVAL>9.6 then CTCTERM = ""Hypercalcemia""; Else CTCTERM = """";"
1,CAF04C,SERUM Calcium (mg/dL),9.2184368,M,44,18,59,11.5,12.5,13.5,13.5,8,7,6,6,"If AVAL<8.6 then CTCTERM = ""Hypocalcemia""; Else if AVAL>10 then CTCTERM = ""Hypercalcemia""; Else CTCTERM = """";"
1,CAF04C,SERUM Calcium (mg/dL),9.2184368,M,44,13,17,11.5,12.5,13.5,13.5,8,7,6,6,"If AVAL<8.4 then CTCTERM = ""Hypocalcemia""; Else if AVAL>10.2 then CTCTERM = ""Hypercalcemia""; Else CTCTERM = """";"
1,CAF04C,SERUM Calcium (mg/dL),8.73747488,M,44,2,12,11.5,12.5,13.5,13.5,8,7,6,6,"If AVAL<8.8 then CTCTERM = ""Hypocalcemia""; Else if AVAL>10.8 then CTCTERM = ""Hypercalcemia""; Else CTCTERM = """";"
1,CAF04C,SERUM Calcium (mg/dL),8.8176352,M,44,60,90,11.5,12.5,13.5,13.5,8,7,6,6,"If AVAL<8.8 then CTCTERM = ""Hypocalcemia""; Else if AVAL>10.2 then CTCTERM = ""Hypercalcemia""; Else CTCTERM = """";"
1,CAF04C,SERUM Calcium (mg/dL),8.33667328,M,44,60,90,11.5,12.5,13.5,13.5,8,7,6,6,"If AVAL<8.8 then CTCTERM = ""Hypocalcemia""; Else if AVAL>10.2 then CTCTERM = ""Hypercalcemia""; Else CTCTERM = """";"
1,CAF04C,SERUM Calcium (mg/dL),8.6172344,M,44,60,90,11.5,12.5,13.5,13.5,8,7,6,6,"If AVAL<8.8 then CTCTERM = ""Hypocalcemia""; Else if AVAL>10.2 then CTCTERM = ""Hypercalcemia""; Else CTCTERM = """";"
1,CAF04C,SERUM Calcium (mg/dL),8.016032,M,44,60,90,11.5,12.5,13.5,13.5,8,7,6,6,"If AVAL<8.8 then CTCTERM = ""Hypocalcemia""; Else if AVAL>10.2 then CTCTERM = ""Hypercalcemia""; Else CTCTERM = """";"
;;;;
run; Although, I believe I need to look into the creation of the dataset further. This is because I thought the dataset was merged properly before, and that is why I wanted the IF..THEN step done for each row separately. But I've now seen that I now need to merge in the file appropriately and take into account the age and gender of the patients. That is why there were so many different conditions in the Excel file before, because they take into account the gender and the age of the patient too. Althought in this example, there is only one age, which is 44, and one gender, so theoretically, only one condition should be used. Also the code below, was the code which was being executed before (in call execute). I probably need to also add the age and gender conditions into the code now: data lb_ctc_test;
set lb_ctc;
if paramcd="CAF04C" then do;
If AVAL<8.2 then CTCTERM = "Hypocalcemia";
Else if AVAL>9.6 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
if paramcd="CAF04C" then do;
If AVAL<8.8 then CTCTERM = "Hypocalcemia";
Else if AVAL>10.2 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
if paramcd="CAF04C" then do;
If AVAL<8.6 then CTCTERM = "Hypocalcemia";
Else if AVAL>10 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
if paramcd="CAF04C" then do;
If AVAL<8.4 then CTCTERM = "Hypocalcemia";
Else if AVAL>10.2 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
if paramcd="CAF04C" then do;
If AVAL<8.8 then CTCTERM = "Hypocalcemia";
Else if AVAL>10.8 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
if paramcd="CAF04C" then do;
If AVAL<8.2 then CTCTERM = "Hypocalcemia";
Else if AVAL>9.6 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
if paramcd="CAF04C" then do;
If AVAL<8.6 then CTCTERM = "Hypocalcemia";
Else if AVAL>10 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
if paramcd="CAF04C" then do;
If AVAL<8.4 then CTCTERM = "Hypocalcemia";
Else if AVAL>10.2 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
if paramcd="CAF04C" then do;
If AVAL<8.8 then CTCTERM = "Hypocalcemia";
Else if AVAL>10.8 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
if paramcd="CAF04C" then do;
If AVAL<8.8 then CTCTERM = "Hypocalcemia";
Else if AVAL>10.2 then CTCTERM = "Hypercalcemia";
Else CTCTERM = "";;
end;
run; Thank you.
... View more