BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
vegan_renegade
Obsidian | Level 7

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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. 

PaigeMiller_0-1663012019648.png


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.

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

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. 

PaigeMiller_0-1663012019648.png


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.

--
Paige Miller
vegan_renegade
Obsidian | Level 7
You're right, I did have a second right parenthesis on both compute variables, though error only showed on one variable.
ballardw
Super User

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.

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 751 views
  • 2 likes
  • 3 in conversation