Date: Sun, 26 Oct 2003 21:51:08 -0800
Reply-To: "Huang, Ya" <yhuang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, Ya" <yhuang@AMYLIN.COM>
Subject: Re: PROC REPORT, two questions
Content-Type: text/plain; charset="iso-8859-1"
For your question 1, try special format,
for question 2, use order=data:
data dsi;
do vr=3 to 1 by -1;
do vc=1 to 4;
do j=1 to int(ranuni(4)*10);
output;
end;
end;
end;
proc format;
value newpct
low-high=[percent15.1]
.=' 0.0%'
;
value fvro
1='A'
2='B'
3='C'
;
proc report data = dsi (keep = vr vc)
out = dso (drop = _break_)
nowd headline nocenter missing ls = 100;
column ("View of vr by vc " vr vc,(pctn)) ;
define vr / group order=data format=fvro. width = 10 "Row values" ;
define vc / across width = 12 "" ;
define pctn / format = newpct. "" ;
run;
-------------
View of vr by vc
1 2 3 4
Row values
-------------------------------------------------------------------------------
C 50.0% 44.4% 62.5% 0.0%
B 42.9% 44.4% 12.5% 100.0%
A 7.1% 11.1% 25.0% 0.0%
Kind regards,
Ya Huang
-----Original Message-----
From: Talbot Michael Katz [mailto:topkatz@MSN.COM]
Sent: Sunday, October 26, 2003 1:51 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: PROC REPORT, two questions
Hi, gang.
I am using PROC REPORT for some simple grouping and counting as follows...
proc report data = dsi (keep = vr vc)
out = dso (drop = _break_)
nowd headline nocenter missing ls = 100
;
column ("View of vr by vc" ""
vr vc,(pctn)) ;
define vr / group format = fvro. width =
10 "Row values" ;
define vc / across width =
12 "" ;
define pctn / format = percent15.1
"" ;
run;
I have two problems, MISSING VALUES and ROW ORDER.
Some combinations of the two variables, vc and vr, are not represented in
the data, and they show up as missing values in the report output. Because
these amount to zero counts, I'd like them to show up as zeroes,
specifically as "0.0%" if possible (since the cell values are percentages,
as specified by pctn). Can this be done?
Also, I want the rows to come out in order of the original vr values, but
with the formatted values (fvro. user-defined format) printed. However,
the formatted values have a different order than the original values, and
the report comes out in the order of the formatted values. Is there a way
to preserve the order of the original values, but print the formatted
values?
Thanks!
-- TMK --
|