LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 1 Oct 2002 12:39:17 +0100
Reply-To:     Peter Crawford <peter.crawford@DB.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <peter.crawford@DB.COM>
Subject:      Re: Inserting blank lines into a dataset......
Comments: To: Tom Ragan <tom.ragan@europe.ppdi.com>
Content-type: text/plain; charset=iso-8859-1

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.


Back to: Top of message | Previous page | Main SAS-L page