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 (February 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 5 Feb 2004 12:55:17 +1100
Reply-To:     Philip_Crane@WORKCOVER.VIC.GOV.AU
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Philip_Crane@WORKCOVER.VIC.GOV.AU
Subject:      Re: Pagination problem
Comments: To: Pat Moore <pat.moore@UAA.ALASKA.EDU>
Content-type: text/plain; charset="us-ascii"

Pat

Assuming you have two years worth of data combine them and set a variable as the academic year.

data all; set ay98(in=in_ay98) ay99(in=in_ay99); if in_ay98 then ay = 1998; if in_ay99 then ay = 1999; run;

Sort by the institution and year then transpose to make a long thin file instead of a short wide one.

proc sort data=all; by institution ay; run;

proc transpose data=all out=all2; by institution ay; run;

The dataset all2 has 4 columns; institution, year _name_ and col1. The last 2 were created in the transpose name contains your old variable name and col1 its value. Print out a few rows so you can see what has happened.

The report can be generated like this. You can adjust it to suit your needs.

proc report data=all2; column _name_ institution ay,col1; define _name_ / group 'Measure'; define institution / group; define ay / across 'Academic year'; define col1 / ' '; run;

Philip

Pat Moore <pat.moore@UAA.AL To: SAS-L@LISTSERV.UGA.EDU ASKA.EDU> cc: Sent by: "SAS(r) Subject: Pagination problem Discussion" <SAS-L@LISTSERV.U GA.EDU>

05/02/2004 11:05 AM Please respond to Pat Moore

I have four datasets which contain the same variables for a number of educational institutions for each of four academic years. Each year's data looks like this:

Institution FTE Headcount Minority Degrees etc. Podunk U 100 150 20% 50 Nother U 1,000 1,500 18% 500

I need to generate a report that facilitates comparison by academic year, with each column of the dataset report needs to look like this:

Full-time Equivalent Students AY98-99 AY99-00 AY00-01 AY01-02 Podunk U 80 90 150 100 Nother U 30 300 3000 1000

I began by merging the data from the five year, creating a dataset with an observation for each institution consisting of its values for FTE9899 FTE9900, Headcount9899, etc. and then set up proc report with code like this:

Proc report data=ranksay9802 nowd missing; Column Institution City State Citysize Region ('FTE Students' Institution FTES0102 FTES0001 FTES9900 FTES9899) ('Headcount Students' Heads0102 Heads0001 Heads9900 Heads9899 ) ('Percent Part-Time Students' etc.

The problem is pagination. I don't have a break variable that changes after the four academic years go by, so I wind up with one really long report that I can't print.

A friend (David Neal) suggested that I could use arrays and do loops to generate a series of reports with a macro. Something like:

array schools (* Institution City State Citysize Region Institution FTES0102 FTES0001, etc) for i=1 to whatever do %macro report (inst,var1,var2,var3...) proc report, etc.

And run the data in groups of four, producing separate output for each variable which could be printed or output to spreadsheets or whatever.

Then, David suggested that there must be an easier way, which is why I'm posting this. Any ideas?

As always, if any member of the SAS-L force is caught or killed, the Secretary will disavow all knowledge...

Pat Moore mailto:pat.moore@uaa.alaska.edu


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