f



Re: Include SAS code w/o including SAS code #4

I actually never want to store the macro code. I only want it available in a
temp file which I then consume. For example:

%macro xyz;
   data temp.temp4;
   ...do some sas stuff...
  run;
%mend;


I want to save the contents, formatted, into a text file (i.e.
c:\temp\program.sas) which I can then consume in another application. I also
want to execute the code. Hence:

%xyz;

Save the contents of the macro file to a text file with CRLF included. I
don't want the run, merely the statements.

Thoughts?

Alan

Alan Churchill
Savian
www.savian.net


-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Fehd,
Ronald J. (CDC/CCHIS/NCPHI)
Sent: Tuesday, August 12, 2008 8:15 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Include SAS code w/o including SAS code

you want to save the macro code in its own file

access then depends on modifying one of the three uses of the word:
SASautos

Tutorials
A SASautos Companion: Reusing Macros

http://tinyurl.com/45nzzk for:

http://www2.sas.com/proceedings/sugi30/267-30.pdf


Ron Fehd  the macro maven  CDC Atlanta GA USA RJF2 at cdc dot gov


> -----Original Message-----
> From: Alan Churchill
> Ok, I think this might be doable but I am drawing a blank.
> Suppose I have this code:
> %macro xyz;
>    data temp.temp4;
>    .do some sas stuff.
>   run;
> %mend;
>
> Is there a way to write the macro statements out to a file? I
> can run them
> but I would also like to save them outside of SAS.
0
savian001 (795)
8/12/2008 2:41:35 PM
comp.soft-sys.sas 142827 articles. 3 followers. Post Follow

0 Replies
823 Views

Similar Articles

[PageSpeed] 11

Reply:

Similar Artilces:

Re: Include SAS code w/o including SAS code
I want the statements only, not the processing. Alan Alan Churchill Savian www.savian.net -----Original Message----- From: ./ ADD NAME=Data _null_, [mailto:iebupdte@gmail.com] Sent: Tuesday, August 12, 2008 6:20 AM To: Alan Churchill Cc: SAS-L@listserv.uga.edu Subject: Re: Include SAS code w/o including SAS code You need to provide more details. It is unclear to me if you want the statements generated by the macro MPRINT/MFILE written to the file or the MACRO definition FILE/PUT. Syntax MFILE | NOMFILE MFILE routes output produced by the MPRINT option to an external file. This is usef...

Re: Include SAS code w/o including SAS code #14
Charles, I did very similar things across multiple datacenters with NDM and the JCL Reader awhile back. And yes, explaining a SyncSort, EasyTrieve, SAS milkshake to a newbie was an exercise in frustration. Hell, I told them early on that SyncSort had limited commands (7 at the time?) but would take them years to master threw them for a loop. Welcome to binary ;-] That said, I think the details of what I am doing need something else. The problem with tossing out a problem on SAS-L (and elsewhere) is that the particular need is generalized to the point of losing what the original constraints ...

Re: Include SAS code w/o including SAS code #7
I don't believe there is inconsistency in my statement. I don't want the log (run), just the statements. A macro is a macro so I can always run it if need be but the main gist is that I need the statements. I will just break the statements myself and do the formatting using Don's technique. Thanks for the help, Alan Alan Churchill Savian www.savian.net -----Original Message----- From: ./ ADD NAME=Data _null_, [mailto:iebupdte@gmail.com] Sent: Tuesday, August 12, 2008 9:05 AM To: Alan Churchill Cc: SAS-L@listserv.uga.edu Subject: Re: Include SAS code w/o including SAS code You...

Re: Include SAS code w/o including SAS code #11
Thanks Ian. I actually switched it over to a %include since readability is critical here. The only other method I can think of is to use datalines but that is not as convenient either. The underlying problem behind this exercise was: How can I have a set of valid SAS statements be filed into a text file and also be available for execution? Immediately, I said %include since that is obvious. However, I was hoping to also be able to see the lines and make quick modifications in the editor. Since I have had time to think about it some more, I decided to go ahead and split it out into 2 progra...

Re: Include SAS code w/o including SAS code #13
What you ask can be done (just about <anything> can be done in sas), but at what price? The put statement is your friend--think if you were to generate a whole job, not just a macro. The problem comes if you have any macro variables that would need to be resolved when the second job runs-- now you have to play with quoting, so that sas doesn't try to interpret them at compile time. And that can cause horrible headaches, esp if there are some macro vars that you do want evaluated at compile time. I have some code that was used on the mainframe to generate dynamically created jobs ...

Re: Include SAS code w/o including SAS code #12
OK, now I get it. You don't know that you already have what you need. In your example you say... Suppose I have this code: %macro xyz; data temp.temp4; .do some sas stuff. run; %mend; So you have it you don't need to get it you've already got it. The formatting that you desire is right there, no problem. If the macro is in aggregate storage location then you also "have it". It is waiting be auto called, read with infile, or opened with an editor. If it is stored compiled and the source was saved you can look at the source just as Andre suggested using %copy. ...

Re: Include SAS code w/o including SAS code #8
You are not consistent. One time you say you don't want to execute the macro then you say you do. Question: Where is the "macro" when YOU begin to want it? Please describe your processing in complete detail. On 8/12/08, Alan Churchill <savian001@gmail.com> wrote: > I actually never want to store the macro code. I only want it available in a > temp file which I then consume. For example: > > %macro xyz; > data temp.temp4; > ...do some sas stuff... > run; > %mend; > > > I want to save the contents, formatted, into a text file (i.e. &g...

Re: Include SAS code w/o including SAS code #10
Summary: Macro generation of correct SAS code requires SAS execution. #iw-value=1 Alan, I do not see how this is possible. Consider: %macro q ( seed=0 ) ; %local cum ; data w ( keep = r ) ; do i = 1 to 20 ; r = ranuni ( &seed ) ; output ; end ; run ; data _null_ ; set w end = eof ; cum + r ; if eof then call symputx ( "cum" , cum ) ; run ; title1 "Cum = &cum" ; %mend q ; This macro ends up generating a TITLE statement. However, that title ...

Re: Include SAS code w/o including SAS code #6
Good Don. I should have remembered that trick from SGF. One minor issue, it doesn't preserve formatting. Other than doing the string split myself, any suggestions? Alan Alan Churchill Savian www.savian.net -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Don Henderson Sent: Tuesday, August 12, 2008 7:37 AM To: SAS-L@LISTSERV.UGA.EDU Subject: FW: Include SAS code w/o including SAS code resending as I did not mean to send to just Andre ---------------------------------------- > From: donaldjhenderson@hotmail.com > To: wielki@ined.fr ...

Re: FW: Include SAS code w/o including SAS code
On Tue, 12 Aug 2008 13:36:52 +0000, Don Henderson <donaldjhenderson@HOTMAIL.COM> wrote: >resending as I did not mean to send to just Andre > >---------------------------------------- >> From: donaldjhenderson@hotmail.com >> To: wielki@ined.fr >> Subject: RE: Include SAS code w/o including SAS code >> Date: Tue, 12 Aug 2008 13:34:41 +0000 >> >> >> Alan, >> >> If you want the generated SAS code try (untested): >> >> data _null_; >> file "code.sas"; >> length code $32000; >> code = res...

Re: Include SAS code w/o including SAS code #2
Alan, not precisely clear what you are searching think thus also about this kind of program in addition to the mprint mfile answer of ~data _null_ HTH Andre libname malibmac "d:\temp"; options mstores sasmstore=malibmac; %macro foobar(aarg)/store source des='nothing or interresting'; %put arg=&arg; %mend; %copy foobar/source; Alan Churchill a �crit : > All, > > > > Ok, I think this might be doable but I am drawing a blank. > > > > Suppose I have this code: > > > > %macro xyz; > > data temp.temp4; > > .do some s...

Re: Include SAS code w/o including SAS code #3
You need to provide more details. It is unclear to me if you want the statements generated by the macro MPRINT/MFILE written to the file or the MACRO definition FILE/PUT. Syntax MFILE | NOMFILE MFILE routes output produced by the MPRINT option to an external file. This is useful for debugging. On 8/12/08, Alan Churchill <savian001@gmail.com> wrote: > All, > > > > Ok, I think this might be doable but I am drawing a blank. > > > > Suppose I have this code: > > > > %macro xyz; > > data temp.temp4; > > .do some sas stuff. > >...

Re: Include SAS code w/o including SAS code #5
you want to save the macro code in its own file access then depends on modifying one of the three uses of the word: SASautos Tutorials A SASautos Companion: Reusing Macros http://tinyurl.com/45nzzk for: http://www2.sas.com/proceedings/sugi30/267-30.pdf Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov > -----Original Message----- > From: Alan Churchill > Ok, I think this might be doable but I am drawing a blank. > Suppose I have this code: > %macro xyz; > data temp.temp4; > .do some sas stuff. > run; > %mend; > > Is there a way t...

Re: Include SAS code w/o including SAS code #9
Remember the formatting/indentation is lost in macro anyway as white space = is not relevant. The best you can do is what mprint does for you - a new st= atement on column 1 on on new line. =20 -don> Date: Tue=2C 12 Aug 2008 08:38:31 -0600> From: savian001@GMAIL.COM> S= ubject: Re: Include SAS code w/o including SAS code> To: SAS-L@LISTSERV.UGA= ..EDU> > Good Don. I should have remembered that trick from SGF. One minor i= ssue=2C it> doesn't preserve formatting. Other than doing the string split = myself=2C any> suggestions?> > Alan> > Alan Churchill>...

Web resources about - Re: Include SAS code w/o including SAS code #4 - comp.soft-sys.sas

70M Facebook Shares To Hit The Market, Including 41.35M From Mark Zuckerberg
... public offering of class-A common stock, with 27,004,761 coming from the company itself and another 42,995,239 from certain stockholders, including ...

Latino Youth Interrupt President Obama Speech to Protest His One Million Deportations, Including Many ...
Presente.org hat eine Notiz mit dem Titel Latino Youth Interrupt President Obama Speech to Protest His One Million Deportations, Including Many ...

Data visualization company SumAll raises $6M, including $500K for charity foundation
Data visualization company SumAll today announced it raised $6 million in a Series A round led by Battery Ventures. The funding agreement includes ...

Twitter Introduces Custom Timelines, Including Developer API
Like Storify, built right into Twitter itself.

Thailand Travel Guide with Offline Maps – tripwolf (including Bangkok, Phi Phi Islands, Chiang Mai, Koh ...
Get Thailand Travel Guide with Offline Maps – tripwolf (including Bangkok, Phi Phi Islands, Chiang Mai, Koh Phangan, Koh Samui) on the App Store. ...

Image taken from page 332 of 'Adventures in the far interior of South Africa; including a journey to ...
Image taken from: Title: "Adventures in the far interior of South Africa; including a journey to Lake Ngami, and rambles in Honduras. To which ...

Zellers Everything Must GO Including Zeddy
http://goo.gl/E0gDo Zellers stores are closing and everything must go, even Zeddy. The Zellers Executive Managing Director has taken it upon ...

30 sites including Inca trails, ancient French cave vie for World Heritage status
The World Heritage Committee gathers in Doha to decide which natural and cultural sites should get their names included on its 981-strong list. ...

Dodo releases NBN plans including unlimited data plan
Dodo has today announced its new range of consumer NBN plans, including a plan offering unlimited data per month.

Gina Rinehart children seek profits from iron ore projects including Roy Hill and Hope Downs
Gina Rinehart&#8217;s two estranged children are seeking to claw back profits from the mining magnate&#8217;s major iron ore projects they say ...

Resources last updated: 2/12/2016 3:49:23 AM