Date: Tue, 30 Jan 2007 10:29:12 -0500
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Title statements inside Procs
Then there is PROC FORMAT, which treats QUIT as a synonym for RUN, but
processes one statement at a time, like PROC SQL ... somewhat.
Consider this log
1 options formchar="|----|+|---+=|-/\<>*"
2 nodate nonumber nocenter;
3
4 proc format fmtlib;
5
6 title 'First Format';
7 value first other='First Label';
NOTE: Format FIRST has been output.
8
9 %put Exercising format first: %sysfunc(putn(.,first.) );
Exercising format first: First Label
10
11 title 'Second Format';
12 value second other='Second Label';
NOTE: Format SECOND has been output.
13
14 run;
So the first format is available for use before the second VALUE statement
is processed.
Now look at the output:
Second Format
----------------------------------------------------------------------------
| FORMAT NAME: FIRST LENGTH: 11 NUMBER OF VALUES: 1 |
| MIN LENGTH: 1 MAX LENGTH: 40 DEFAULT LENGTH 11 FUZZ: STD |
|--------------------------------------------------------------------------|
|START |END |LABEL (VER. V7|V8 30JAN2007:10:18:13)|
|----------------+----------------+----------------------------------------|
|**OTHER** |**OTHER** |First Label |
----------------------------------------------------------------------------
----------------------------------------------------------------------------
| FORMAT NAME: SECOND LENGTH: 12 NUMBER OF VALUES: 1 |
| MIN LENGTH: 1 MAX LENGTH: 40 DEFAULT LENGTH 12 FUZZ: STD |
|--------------------------------------------------------------------------|
|START |END |LABEL (VER. V7|V8 30JAN2007:10:18:13)|
|----------------+----------------+----------------------------------------|
|**OTHER** |**OTHER** |Second Label |
----------------------------------------------------------------------------
Both dumps appear under the second title; there is no page break. PROC
FORMAT waits until the end of processing to generate the output, so you
cannot swap titles.
On Tue, 30 Jan 2007 14:36:28 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:
>Art ,
>
>Yeah I think you are right and I havent had enough coffee for my brain to
>kick and stayed up way too late last night playing with Perl. Thinking
>about it I would say it has more to do with ( Run group processing , I think
>that is right) than SQL or IML specifically.
>
>
>
>Toby Dunn
>
>From: Arthur Tabachneck <art297@NETSCAPE.NET>
>Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Re: Title statements inside Procs
>Date: Tue, 30 Jan 2007 09:29:56 -0500
>
>Toby,
>
>I don't have time to test it right now, but I would think that gplot, reg
>and some others may fall into the same category.
>
>Art
>--------
>On Tue, 30 Jan 2007 14:25:24 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:
>
> >Howard ,
> >
> >Good point but SQL and IML are special cases where the code gets executed
> >asap (ie as it is encountered) rather than say in a data step where the
>data
> >step code gets compiled and then executed. I still dont understand why
>SAS
> >implemented these two Procs this way especially since they are opposite of
> >the rest of SAS.
> >
> >
> >
> >
> >Toby Dunn
> >From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
> >Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
> >To: SAS-L@LISTSERV.UGA.EDU
> >Subject: Re: Title statements inside Procs
> >Date: Mon, 29 Jan 2007 23:24:06 -0500
> >
> >On Tue, 30 Jan 2007 04:05:43 +0000, toby dunn <tobydunn@HOTMAIL.COM>
>wrote:
> >
> > >David ,
> > >
> > >No, they are global and them being bound to a proc would violate that.
>It
> > >comes down to having a firm grasp of programming and the dangers in
>global
> > >data. As for th eTitle statement being embedded inside of a Proc step
> > >boundary well I consider this bad coding habit. My title and footnotes
> > >always come before my procs and I ussually always run my macro which
> >clears
> > >these afterwards.
> >
> >But never say "never". Consider
> >
> > proc sql;
> > title 'Boys';
> > select * from sashelp.class where sex='M';
> > title 'Girls';
> > select * from sashelp.class where sex='F';
> > quit;
> >
> > >From: "Johnson, David" <David.Johnson@CBA.COM.AU>
> > >Reply-To: "Johnson, David" <David.Johnson@CBA.COM.AU>
> > >To: SAS-L@LISTSERV.UGA.EDU
> > >Subject: Title statements inside Procs
> > >Date: Tue, 30 Jan 2007 14:47:22 +1100
> > >
> > >I have just been speaking with a colleague, explaining the process for
> > >updating titles with macro symbols.
> > >
> > >We looked at SASHELP.VTITLE so I could explain some update processes and
> > >she expressed surprise that the titles were stored separately from the
> > >Proc. She had been mystified by the persistence of titles between
> > >outputs.
> > >
> > >She had copied SAS documentation where the Title is indented into and
> > >enclosed within the Proc, and incorrectly assumed that it was a
> > >Procedure rather than a global one.
> > >
> > >So, quick straw poll: have you or any colleagues been similarly misled
> > >by global statements being embedded in data steps or procs within
> > >documentation?
> > >
> > >Kind regards
> > >
> > >David
|