Prev: STDM AE Start and End Reference
Next: Legend problem
From: ankur on 6 Jan 2010 11:48 How do I make a macro variable take value "%let modelvars= " ??? Following doesn't work %let myvar = %let modelvars= ; Thanks, Ankur Bohra.
From: Tom Abernathy on 6 Jan 2010 12:04 You can look at macro quoting functions (%quote,%bquote,%str, %nrstr,...) Or you can just use a DATA step. data _null_; call symput('myvar','%let modelvars='); run; On Jan 6, 11:48 am, ankur <ankur.bo...(a)gmail.com> wrote: > How do I make a macro variable take value "%let modelvars= " ??? > Following doesn't work > %let myvar = %let modelvars= ; > > Thanks, > Ankur Bohra.
From: billyk43 on 6 Jan 2010 12:03 This should do the trick: %let myvar = %nrstr(%let modelvars=); On Jan 6, 11:48 am, ankur <ankur.bo...(a)gmail.com> wrote: > How do I make a macro variable take value "%let modelvars= " ??? > Following doesn't work > %let myvar = %let modelvars= ; > > Thanks, > Ankur Bohra.
From: Mack Lindsey on 6 Jan 2010 12:30 Try this: %let myvar = %nrstr(%let modelvars= ;); Mack Lindsey -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of ankur Sent: Wednesday, January 06, 2010 10:49 AM To: SAS-L(a)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.
From: xlr82sas on 6 Jan 2010 15:57
On Jan 6, 9:30 am, Mack.Lind...(a)CPA.STATE.TX.US (Mack Lindsey) wrote: > Try this: > > %let myvar = %nrstr(%let modelvars= ;); > > Mack Lindsey > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SA...(a)LISTSERV.UGA.EDU] On Behalf Of > > ankur > Sent: Wednesday, January 06, 2010 10:49 AM > To: SA...(a)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 |