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
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1091 views
  • 0 likes
  • 2 in conversation