Date: Tue, 1 Oct 2002 19:29:58 -0700
Reply-To: lpogoda <lpogoda@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: lpogoda <lpogoda@HOTMAIL.COM>
Organization: http://groups.google.com/
Subject: Re: Inserting blank lines into a dataset......
Content-Type: text/plain; charset=ISO-8859-1
Whilst I'm aware that PROC REPORT is regarded by many as the
dromedary's drawers, I confess that I don't quite get it. This
example illustrates my puzzlement quite well.
It often seems that it's necessary to use one to several DATA steps to
get everything in order for PROC REPORT - essentially writing the
output to a data set - and then writing the PROC REPORT code on top of
that.
It seems to me to be far easier to just write the output using a
_null_ data step instead and be done with it. In this case, the
output could be written to a file with a .doc extension, and DDE could
be used to open that file in Word and save it in RTF format.
For whatever reason, the original poster was tasked with using ODS.
Can't ODS accept data step output as well as proc step output? Is
using ODS using a cannon when a water pistol would do the job? What's
the advantage to PROC REPORT when you have to practically write the
output using data steps first?
Can someone explain the advantage to me?
peter.crawford@DB.COM (Peter Crawford) wrote in message news:<OF639B459A.D9348CB7-ON41256C45.003B27B4@db.com>...
> Thank you Tom, that clarifies....
> You may find some ProcReport experts on SAS-L have already
> approached problems like yours and come up with different
> solutions.. It is usually worth asking about the underlying issue..
>
> To insert blank lines in the data at the points you need, your data
> set must be rewritten, because the sql insert statement acts just
> like proc append. (unless your data set has indexes that can deliver
> rows in the order you want, and you can provide key values to insert
> suitably). However, inserting entirely empty rows where you need
> can be achieved without knowing anything about the record structure.
> .... except that as this method uses variable and array names,
> these names should not also be in your dataset.
>
> ************** beware that this has not been tested ;
> *assumption 2:- Input dataset is your.dataset
> and output dataset is your.extended_dataset;
> data empty(label='empty observation, like your.dataset');
> output;
> stop;
> set your.dataset;
> run;
>
> * define your inserts/after pairs here;
> %let inserts = 3 31 3 62 4 93 5 100 2 110;
> /* inserts after_row_number */
> %let n_inserts = %eval( %nWords( &inserts /2 ) ) ;
> * macro nWords should be available in sas-l archives;
>
> data your.extended_dataset;
> array atno(2:&n_inserts ) _temporary_ (&inserts) ;
> * First, deal with inserts ;
> do case= 1 to &n_inserts;
> do row = 1 to atno(2, case) ;
> link sets;
> output;
> end;
> do row = 1 to atno(1,case);
> link emptys;
> output;
> end ;
> end;
> * Next, deal with the rest or original, if any ;
> do while( not eof_original);
> link sets;
> output;
> end;
> * Having regenerated all the data, now ;
> STOP ;
>
> sets:
> set your.dataset end = eof_original ;
> return;
> emptys:
> set empty point=Empty_nobs nobs=Empty_nobs ;
> * point avoids setting end-of-file;
> return;
> * ensure process variables do not go into output;
> drop case row ;
> * other names used, to be aware of:-
> eof_original, Empty_nobs, atno ;
> run;
>
> ************** beware that that has not been tested ;
>
>
> Regards
> Peter Crawford
>
>
>
>
>
>
>
>
>
>
>
> Datum: 01/10/2002 10:40
> An: Peter Crawford/Zentrale/DeuBaExt@Zentrale
>
>
>
> Betreff: Re: Antwort: Inserting blank lines into a dataset......
> Nachrichtentext:
>
> Hi Peter,
>
> We are struggling with SAS ODS RTF. Our client wants output in RTF no question.
> Up till now we've been using DDE in SAS V6, but I've been assigned the task of the transition to ODS RTF.
> Most problems have been surmounted, but the problem remains with ODS RTF having the inability to
> count vertically. Say I've got a table that needs to portray 5 lots of summary stats - n, mean, median, SD, min, max
> Q1 and Q2 - ie. 5 lots of blocks of 8 lines of data. If I can only fit 2 entire blocks on one page and having one block flowing
> from one page onto the next is out of the question, then I either have create a page counting/breaking variable or I can
> insert blank lines into my final dataset before ODS RTF and proc report to make my data fit the page.
> In fact we have to do both as on occasion we have to retain information on order variables over more than one page.
>
> Hope this clarifies the problem.
>
> Cheers,
>
> Tom
>
> Peter Crawford wrote:
>
> > Hi Tom
> > please may I ask why you want to do this ?
> > egards
> > Peter
> >
> > Datum: 01/10/2002 10:16
> > An: SAS-L@LISTSERV.UGA.EDU
> >
> > Antwort an: Tom Ragan <tom.ragan@EUROPE.PPDI.COM>
> >
> > Betreff: Inserting blank lines into a dataset......
> > Nachrichtentext:
> >
> > Hello all,
> >
> > I've been trying to write a macro whereby I can insert any number of
> > blank lines at any point in an input dataset - ie. my macro variables
> > would ideally be:
> > 1) Input dataset
> > 2) Line at which blank lines need to be inserted
> > 3) Number of blank lines to be inserted
> >
> > Due to my relative inexperience in SAS I am having some problems
> > especially when it comes to the separate handling of numeric and
> > character variables. Any suggestions would be very welcome.
> >
> > Thanks in advance,
> >
> > Tom
> >
> > --
> >
>
>
>
>
>
>
> --
>
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
>
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
|