LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 13 Dec 2005 23:26:47 -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: Page break algorithm in SAS?

On Wed, 14 Dec 2005 04:15:16 +0000, toby dunn <tobydunn@HOTMAIL.COM> wrote:

>Julie, > >Sounds like it would take multiple passes of the data.

I think so too, to create a variable indicating the number of companies in the current STATE/TYPE group. Call it GROUPSIZE.

The key tool for dealing with this kind of problem is the LINESLEFT= option on the FILE statement.

Then, at any point in the process, the number of lines needed can be computed according to the rules, and compared with the remaining space on the current page.

> >That said I must ask do you have to go the SAS excel PDF route, can you go >the SAS to PDF. > >r if you can firstbreak the fie up the way you want then shoot those files >to excel it might help. > >Toby Dunn > > > > > >From: oseithedude@GMAIL.COM >Reply-To: oseithedude@GMAIL.COM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Page break algorithm in SAS? >Date: Tue, 13 Dec 2005 15:01:08 -0800 > >Hello! I have a dataset containing the names of approximately 1,000 >organization (variable = name), the state that the organization is in >(variable = state), and a numeric id indicating whether the >organization type is public or private (variable = id). There is also >some financial data for each organization in this dataset but that is >irrelevant. Every year, I take this dataset and transfer the names from >it to a hardcopy publication (a generalized example of what a couple of >the pages look like can be found at this website: >http://tinyurl.com/agvd7 - the actual organization names were taken out >and replaced with generic names but they are ordered alphabetically >within the state and type of organization). > >I'm trying to figure out if there is a way I can, using SAS, determine >which organization is the last organization on each page (there usually >end up being around 16 or 17 pages)? From the original dataset, I have >a SAS program that exports the data into a text file, and from that >text file I do a lot of cut and pasting into Excel before converting >the Excel file into PDF. > >Let me describe to you the way the organization names are set up in the >table: > >1) The names are sorted first alphabetically by state (organizations in >Alabama first; Wyoming last), then by whether they are public or >private (IF there are public organizations they are displayed first, >followed by all private organizations, IF there are any), then >alphabetically by organization name. The names are already sorted this >way in the original dataset. There is at least one organization in >every state, but there are some states that don't have any public >organizations and some that don't have any private organizations. >Again, >you can go to this website: http://tinyurl.com/agvd7 for an example of >some pages. > >2) In listing the organizations, I use 80 lines for each page. The 80 >lines start at the bottom of the table header and extend down to where >the last organization of the page is listed. For every page, the first >line after the table header is always blank. The second line always >contains the current state name. The third line is always blank. The >4th line always contains an indication of type of organization (public >or private). The 5th line is where the listing of organizations begins >and the listing of organizations continues all the way down to the 80th >line. > >3) Up to six organizations can be grouped together in one "block". For >example, you can have an organization name on up to 6 consecutive lines >(e.g., the 5th, 6th, 7th, 8th, 9th, and 10th lines). But if there is a >seventh organization there has to be a blank line seperating the 6th >and 7th organizations. All organizations in a "block" must also be of >the same type (public vs. private). If, for example, you have three >public organizations in a state, they can all be listed together in the >same block but if the remaining organizations in the state are private, >there should be a blank line after the third public organization, then >a line with a "Private" header, and then a listing of the private >organizations starting on the next line after that. > >4) When you reach the last organization in a state, there should be a >blank line on the next line, then the next state's name on the >following line, then another blank line on the line after that, >followed by a header line indicating "Public" or "Private" >organization. > >5) The last 4 lines (of the 80 lines on each page) can't be a line >containing a state name header. The last two lines of the 80 lines >can't be a line indicating type of organization (public or private). >The last line of each page must be an organization name. > >Is it possible to create a program in SAS that can go through the >dataset and tell me, based on the rules above, which organization name >should be on the last line of each page? I'm guessing there has to be >some way to keep track, knowing the number of private and public >organizations in each state and following the formatting rules above, >of which organization is placed on the last line of each page. I know >that multiple "counters" would be involved but I'm not exactly sure how >to organize this all to make it work. > >If someone could help me with this, it would be vey much appreciated! > >Julie


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