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.
%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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: