Date: Thu, 5 Feb 2004 12:55:17 +1100
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Subject: Re: Pagination problem
Content-type: text/plain; charset="us-ascii"
Assuming you have two years worth of data combine them and set a variable
as the academic year.
if in_ay98 then ay = 1998;
if in_ay99 then ay = 1999;
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;
proc transpose data=all out=all2;
by institution ay;
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
proc report data=all2;
column _name_ institution ay,col1;
define _name_ / group 'Measure';
define institution / group;
define ay / across 'Academic year';
define col1 / ' ';
<pat.moore@UAA.AL To: SAS-L@LISTSERV.UGA.EDU
Sent by: "SAS(r) Subject: Pagination problem
Please respond to
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
Proc report data=ranksay9802 nowd missing;
Institution City State Citysize Region
Institution FTES0102 FTES0001 FTES9900 FTES9899)
Heads0102 Heads0001 Heads9900 Heads9899 )
('Percent Part-Time Students'
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...