Getting error in the log: "Expecting ;. The symbol is not recognized and will be ignored". If I comment out compute discharge date section in the compute block, the error does not show. I am attempting to traffic light so if there is a hospital admission date, then we should also have a discharge date. Similarly, if we have a discharge date, we should have an admission date. I don't see where I'm missing a semi-colon. I have seen SAS throw errors that are not applicable before though.
Error when running this:
proc report data=Cohortb1_2022Q3Q4;
columns
record_number
admission_date
discharge_date;
define admission_date / Display 'Admission Date To Diagnostic Facility';
define discharge_date / Display 'Discharge Date From Diagnostic Facility';
define record_number / 'Record Number';
compute admission_date;
if admission_date = . and discharge_date ne .
then call define(_col_,'style','style={background=red})');
endcomp;
compute discharge_date;
if admission_date ne . and discharge_date = .
then call define(_col_,'style','style={background=red})');
endcomp;
run;
No error when commenting out compute discharge date section:
proc report data=Cohortb1_2022Q3Q4;
columns
record_number
admission_date
discharge_date;
define admission_date / Display 'Admission Date To Diagnostic Facility';
define discharge_date / Display 'Discharge Date From Diagnostic Facility';
define record_number / 'Record Number';
compute admission_date;
if admission_date = . and discharge_date ne .
then call define(_col_,'style','style={background=red})');
endcomp;
/*compute discharge_date;*/
/* if admission_date ne . and discharge_date = .*/
/* then call define(_col_,'style','style={background=red})');*/
/*endcomp;*/
run;
Getting error in the log: "Expecting ;. The symbol is not recognized and will be ignored".
Show us the log. Show us every single line in the log for this PROC. Do this every time you get an error in the log. Showing us just the error messages is usually not enough. Copy the log as text and paste it into the window that appears when you click on the </> icon.
Although if I had to guess, you have code where there is one left parenthesis and two right parentheses. That seems like it would cause an error.
Getting error in the log: "Expecting ;. The symbol is not recognized and will be ignored".
Show us the log. Show us every single line in the log for this PROC. Do this every time you get an error in the log. Showing us just the error messages is usually not enough. Copy the log as text and paste it into the window that appears when you click on the </> icon.
Although if I had to guess, you have code where there is one left parenthesis and two right parentheses. That seems like it would cause an error.
Not saying it is the cause of your error and definitely agree with @PaigeMiller about including the entire log.
You may want to look at both of the lines like this:
then call define(_col_,'style','style={background=red})');
Both of your conditional Call define statements have unbalanced parentheses which is seldom a good thing.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.