BookmarkSubscribeRSS Feed
yhc_90
Calcite | Level 5

I'm having issues when using the macro %INCLUDE. I'm trying to score a dataset using the SAS code generated from SAS EM (decision tree). I can run the code fine for 10 trees, but two of them give me: ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,  a missing value, arrayname, (, +, -, INPUT, NOT, PUT, ^, _NEW_, ~. .

 

Here's my code:

DATA Score; 
		SET TREE.score;
		%INCLUDE "/data/tree1_score.sas";
run;

Here's the log file:

22         GOPTIONS ACCESSIBLE;
23         	* Score data;
24         		
24       !   DATA Score;
25         		SET TREE.score;
26         		     %INCLUDE "/data/tree1_score.sas";
MLOGIC(DMNORMIP):  Beginning execution.
MLOGIC(DMNORMIP):  This macro was compiled from the autocall file /usr/local/sas/SASHome/SASFoundation/9.4/sasautos/dmnormip.sas
MLOGIC(DMNORMIP):  Parameter IN has value _ARBFMT_12
SYMBOLGEN:  Macro variable IN resolves to _ARBFMT_12
MPRINT(DMNORMIP):   call dmnorm(_ARBFMT_12,
MLOGIC(DMNORLEN):  Beginning execution.
MLOGIC(DMNORLEN):  This macro was compiled from the autocall file /usr/local/sas/SASHome/SASFoundation/9.4/sasautos/dmnorlen.sas
MPRINT(DMNORLEN):  32
MLOGIC(DMNORLEN):  Ending execution.
MPRINT(DMNORMIP):  );
MLOGIC(DMNORMIP):  Ending execution.
MLOGIC(DMNORMIP):  Beginning execution.
MLOGIC(DMNORMIP):  This macro was compiled from the autocall file /usr/local/sas/SASHome/SASFoundation/9.4/sasautos/dmnormip.sas
MLOGIC(DMNORMIP):  Parameter IN has value _ARBFMT_12
SYMBOLGEN:  Macro variable IN resolves to _ARBFMT_12
MPRINT(DMNORMIP):   call dmnorm(_ARBFMT_12,
MLOGIC(DMNORLEN):  Beginning execution.
MLOGIC(DMNORLEN):  This macro was compiled from the autocall file /usr/local/sas/SASHome/SASFoundation/9.4/sasautos/dmnorlen.sas
MPRINT(DMNORLEN):  32
MLOGIC(DMNORLEN):  Ending execution.
MPRINT(DMNORMIP):  );
MLOGIC(DMNORMIP):  Ending execution.
1027      +*****************************************************************************************
           __
           22
           76
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, 
              a missing value, arrayname, (, +, -, INPUT, NOT, PUT, ^, _NEW_, ~.  

If I change the file to something else, it works just fine. Only two SAS files are problematic.

 

1 REPLY 1
ballardw
Super User

%include isn't actually macro code, more of a directive.

 

Since you say the issue is with two levels of your process then the issue seems to be with your data. You have not include the details of any of the code actually needed that is from the source or autocall macros so it's going to be hard to make suggestions other than your data may be missing something that is expected.

 

You may need to add options Mprintnest source2 to get more details in the log.

 

Subset your data to one of those cases, look at all of the macros called for required parameters and determine if you can fine one or more of them missing from your data.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 1109 views
  • 0 likes
  • 2 in conversation