|
Hi Bob,
This solution works.
By the way, the problem and the solution
are the same for both unix and win.
Adding a %quote() in the macro allows both
the %str() and no function versions to work.
%macro usr_files(file_system);
%if %quote(&file_system) = %str(/opt/app/SASwork1)
%then %put Hello world;
%else %put Goodbye cruel world;
%mend;
%usr_files( %str(/opt/app/SASwork1) ); /* works */
%usr_files( /opt/app/SASwork1 ); /* works */
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investment Group
Russell
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Duell, Bob
Sent: Wednesday, December 27, 2006 1:08 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Quick macro question
Hi all,
I have a macro parameter with a a value that looks like it contains
operators, but in fact is a UNIX path (containing slashes). The macro
complains about expecting a numeric operand when I reference the value
in an IF statement. Here's a simple example:
%macro usr_files(file_system);
%if &file_system = %str(/opt/app/SASwork1)
%then %put Hello world;
%else %put Goodbye cruel world;
%mend;
My macro works only when if I use the %str() function on the parameter
when it's called, i.e.
%usr_files( %str(/opt/app/SASwork1) ); /* works */
%usr_files( /opt/app/SASwork1 ); /* Does not work */
Anyone know of a "trick" to avoid using the %STR() function when I call
the macro?
Thanks,
Bob
|