| Date: | Mon, 4 Aug 2003 16:02:31 +0000 |
| Reply-To: | bilal.khan@TESCO.NET |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Bilal Khan <bilal.khan@TESCO.NET> |
| Subject: | Re: macro quoting difficulty |
|
| Content-Type: | text/plain; charset=ISO-8859-1 |
Hi Kevin,
Is this what you require?
%macro coveredit(x);
%mend;
%macro putcode()/parmbuff;
%put %nrstr(%coverEdit%(indsn=);
%mend putcode;
%putcode();
Bilal Khan.
>
> From: Ian Whitlock <WHITLOI1@WESTAT.COM>
> Date: 2003/08/04 Mon PM 03:04:47 GMT
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: macro quoting difficulty
>
> Kevin,
>
> It is much easier to write macro code with DATA steps than it is with macro.
> It looks to me like you are missing the concept of the DATA step function
> CALL EXECUTE or the DATA step PUT statement, but since I cannot figure out
> the problem your solution is meant to solve I cannot say more.
>
> On the other hand, Kevin Meyer's answer seems to push your solution another
> step further. I just get itchy when one is writing code to be cut and
> pasted. The glue often gums up the works.
>
> Now why didn't %NRBQUOTE work? Well it works at macro execution time which
> is too late. In general if you are writing the symbols that cause trouble
> it is best to hide them at compile time, hence use %STR or %NRSTR and
> possibly the %-escape character.
>
> IanWhitlock@westat.com
> -----Original Message-----
> From: Kevin Auslander [mailto:kauslander@TERRECRS.COM]
> Sent: Friday, August 01, 2003 5:20 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: macro quoting difficulty
>
>
> Ron, coverEdit is a stand alone program that has contains the definition of
> coverEdit. It is included in the autoexec file with %include
> "PathToMacros\coverEdit.sas"; I do not want to loose the % sign because it
> is crucial to what I am trying to do. I want to output to a text file so I
> can copy and paste the resulting macro call to a program where I can modify
> it as necessary. The reason I want to output it to a file with the %putcode
> macro is that I want to call %coverEdit many times with parameters whose
> names increment numerically with each subsequent call. putcode will
> ultimately output code in a loop...Do you see why I cannot just lose the
> percent sign? Then I would have to add it back in a bunch of times. Anyone
> else have better suggestions? I need "%coverEdit(indsn=" to be output with
> all of it's % signs, quotes, and parenthesis. Otherwise I'm stuck going
> through hundreds of macro calls and incrementing the parameters with each
> one. I'd rather do it programmatically.
>
> Kevin
>
>
>
> This communication may contain information that is legally privileged,
> confidential or exempt from disclosure. If you are not the intended
> recipient, please note that any dissemination, distribution, use or copying
> of this communication is strictly prohibited. Anyone who receives this
> message in error should notify the sender immediately by telephone
> (734.663.9030) or by return e-mail, and delete it from his or her computer.
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Fehd,
> Ronald J. (PHPPO)
> Sent: Friday, August 01, 2003 4:50 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: macro quoting difficulty
>
>
> > From: Kevin Auslander [mailto:kauslander@TERRECRS.COM]
> > Hello all. I am trying to do something I thought was simple but has
> > turned into hours of unfruitful trial and error. What I want is a
> > macro that outputs the following line of
> > text: "%coverEdit(indsn=" to the SAS log or a text file.
> > Here is an example of one of my failed attempts that I thought would
> > work but causes an error:
> >
> > %macro putcode();
> > %put %nrbquote("%coverEdit(indsn=");
> > %mend putcode;
> > %putcode();
> >
> > coverEdit is a macro which is included in my autoexec file. Please
> > help me out. Thanks.
>
> where is macro coverEdit?
>
> loose the percent sign before coverEdit
> and figure out where you want this
> %PUT writes only to the log
>
> put writes to the file destination:
> default is log
> otherwise
> file PRINT;
> writes to the output
> or
> file <file-ref or file-spec>;
>
> Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
>
> By using your intelligence
> you can sometimes make your problems twice as complicated.
> -- Ashleigh Brilliant
>
|