BookmarkSubscribeRSS Feed
Filipvdr
Pyrite | Level 9
%let Other_base300 = ;
proc sql noprint;
select Distinct ent_name into: Other_base300 separated by ' '
from base_table_shift
where upcase(facility)=upcase("&facility") and upcase(ToolArea) not in ('WMCE','OVEN','LITHO','ISE');
quit;
%put Other Tools: &Other_base300;

proc report data = spc_final nowd split='#';
columns Month User UserArea ExPmProcedures
('- ISE -' &ISE_base300)
('- LITHO -' &Litho_base300)
( '- OVEN -' &Oven_base300)
%IF "&Wmce_base300" NE "" %THEN ('- WMCE -' &Wmce_base300);
%IF "&Other_base300" NE "" %THEN ('- OTHER-' &Other_base300);
;
label &label_base;
define month /order=data group 'M#o#n#t#h' ;
define User/ order=data Group 'U#s#e#r' ;
define UserArea / /*format=$User2UArea.*/ Order=data 'U#s#e#r#-#A#r#e#a';
define ExPmProcedures/ analysis sum 'E#x#-#P#m#P#r#o#c';
break after Month / summarize ul;
where upcase(facility)=upcase("&facility");
run;

NOTE: Line generated by the macro variable "OTHER_BASE300".
28390 300MM_DICER MAGNUM RAIDER_2 RECUP SCRUBBER


---
22
--------
202
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, _ALL_,
_CHARACTER_, _CHAR_, _NUMERIC_.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

It has to domething with the tool starting with a number 300MDICER. Any help?
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
Without seeing your entire log, I'd say offhand that it is NOT a problem with PROC REPORT. You are using &OTHER_BASE300 in a COLUMN statement. The items that are in a column statement are either your spanning headers (in quotes) -- variable names, computed item names or keyword statistics, such as N or PCTN.

Variable names and computed item names must conform to SAS naming rules. Unless you are using named literals, a SAS variable name can only start with a letter or an underscore -- a SAS variable name CANNOT start with a number.

When your macro varaible &OTHER_BASE300 resolves, the NOTE shows you what it resolves to:
[pre]
NOTE: Line generated by the macro variable "OTHER_BASE300".
28390 300MM_DICER MAGNUM RAIDER_2 RECUP SCRUBBER
[/pre]

300MM_DICER is not a valid SAS variable name to be listed in a COLUMN statement. If this is the correct variable name, then you will have to construct it as a named literal (which is generally something like 'Age Hired'n -- a quoted string followed immediately by an n).

The issue is not with PROC REPORT. You would encounter this issue in any code where you used &OTHER_BASE300 for variable names. The ERROR you got in the log:
[pre]
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, _ALL_,
_CHARACTER_, _CHAR_, _NUMERIC_.
[/pre]

...tells you exactly what it's expecting a name, a quoted string (such as with a named literal reference), or one of the special methods for referencing variables.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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