SAS Macro problem (ERROR 22-322)

lina

New Member
#1
Hi all,

I'm a new member and I need your help!!!

I have the following macro

%macro test
( lib, outfile, file,var, value=);
OPTIONS NOTES SOURCE SOURCE2 MPRINT MLOGIC MERROR ;

data &lib..&outfile;
set data = &lib..&file;
where &var="&value";
run;
%mend test;

but when I call it

%inc '\\Q-srv-fs\scoring\WorkingFiles\Macros\General\TestMAcro1.sas';
%test ( stl,test, stl2,lnn06_Member, value=Οχι );

I get ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, END, KEY,
KEYS, NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.

In fact it seems that the macro works fine, it gives to the parameters the correct values and the problem appears to the where statement. Here is the log:

124 %inc '\\Q-srv-fs\scoring\WorkingFiles\Macros\General\TestMAcro1.sas';
NOTE: %INCLUDE (level 1) file \\Q-srv-fs\scoring\WorkingFiles\Macros\General\TestMAcro1.sas is
file \\Q-srv-fs\scoring\WorkingFiles\Macros\General\TestMAcro1.sas.
125 +
126 +%macro test
127 +( lib, outfile, file,var, value=);
128 +OPTIONS NOTES SOURCE SOURCE2 MPRINT MLOGIC MERROR ;
129 +
130 +data &lib..&outfile;
131 +set data = &lib..&file;
132 +where &var="&value";
133 +run;
134 +%mend test;
135 +
NOTE: %INCLUDE (level 1) ending.
136 %test ( stl,test, stl2,lnn06_Member, value= Ï÷é );
MLOGIC(TEST): Beginning execution.
MLOGIC(TEST): Parameter LIB has value stl
MLOGIC(TEST): Parameter OUTFILE has value test
MLOGIC(TEST): Parameter FILE has value stl2
MLOGIC(TEST): Parameter VAR has value lnn06_Member
MLOGIC(TEST): Parameter VALUE has value Ï÷é
MPRINT(TEST): OPTIONS NOTES SOURCE SOURCE2 MPRINT MLOGIC MERROR ;
MPRINT(TEST): data stl.test;
NOTE 137-205: Line generated by the invoked macro "TEST".
1 OPTIONS NOTES SOURCE SOURCE2 MPRINT MLOGIC MERROR ; data &lib..&outfile; set data =
----
22
1 ! &lib..&file; where &var="&value"; run;
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, END, KEY,
KEYS, NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.

NOTE: Line generated by the invoked macro "TEST".
1 OPTIONS NOTES SOURCE SOURCE2 MPRINT MLOGIC MERROR ; data &lib..&outfile; set data =
-
200
1 ! &lib..&file; where &var="&value"; run;
ERROR 200-322: The symbol is not recognized and will be ignored.

MPRINT(TEST): set data = stl.stl2;
MPRINT(TEST): where lnn06_Member="Ï÷é";
MPRINT(TEST): run;

NOTE: The SAS System stopped processing this step because of errors.

Hope you can help!

Thanx a lot!