LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (January 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 6 Jan 2010 12:57:12 -0800
Reply-To:   xlr82sas <xlr82sas@AOL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   xlr82sas <xlr82sas@AOL.COM>
Organization:   http://groups.google.com
Subject:   Re: Issue with %let
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

On Jan 6, 9:30 am, Mack.Lind...@CPA.STATE.TX.US (Mack Lindsey) wrote: > Try this: > > %let myvar = %nrstr(%let modelvars= ;); > > Mack Lindsey > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of > > ankur > Sent: Wednesday, January 06, 2010 10:49 AM > To: SA...@LISTSERV.UGA.EDU > Subject: Issue with %let > > How do I make a macro variable take value "%let modelvars= " ??? > Following doesn't work > %let myvar = %let modelvars= ; > > Thanks, > Ankur Bohra.- Hide quoted text - > > - Show quoted text -

Hi,

I would be very careful with most of the macro quoting functions, especially when quoting macro code.

I would do the folowing

%let myvar = '/* of */ %% %let modelvars= ;'; or use a data step

Here are just a couple of traps:

%let myvar = %nrstr(/* of */ %% %let modelvars= ;); %put myvar=&myvar; /* SURPRISE */ myvar= % %let modelvars= ;

data tst; if "%nrstr(&myvar)" =: '/* of */ %% %let modelvars=' then put 'Case 1 what I expect'; else put 'Case 1 what I do not expect'; if "&myvar" =: '/* of */ %% %let modelvars=' then put 'Case 2 what I expect'; else put 'Case 2 what I do not expect'; run;

Case 1 what I do not expect Case 2 what I do not expect

%let myvar = '/* of */ %% %let modelvars= ;'; %put &myvar; '/* of */ %% %let modelvars= ;'

data tst; if &myvar =: '/* of */ %% %let modelvars=' then put 'Case 3 what I expect'; else put 'Case 3 what I do not expect'; run;

Case 3 what I expect


Back to: Top of message | Previous page | Main SAS-L page