| Date: | Tue, 9 May 2000 09:03:13 -0700 |
| Reply-To: | Ya Huang <ya.huang@AGOURON.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Ya Huang <ya.huang@AGOURON.COM> |
| Subject: | Re: Dot Plot |
|
| Content-Type: | text/plain; charset=us-ascii |
Amy,
One way to achieve your goal is to use proc plot instead of
chart, but before we use proc plot, we have to count the frequency,
this can be done ver easily by using prof freq:
========
** create test data set;
data xx;
do x=1 to 20;
y=int(uniform(x*999)*10);
output;
end;
** count the frequency;
proc freq noprint;
table y / out=histo;
** expand the x cor, so that it will draw a solid line;
data histo1;
set histo;
do pct=1 to percent;
output;
end;
options ls=65 ps=20;
proc plot nolegend;
plot y*pct='*';
title 'regular histogram';
run;
data histo2;
set histo;
** here we shif the x coordinates, so that it will;
** be shown as centered;
do pct=20-percent/2 to 20+percent/2;
output;
end;
proc plot nolegend;
plot y*pct='*' /hzero;
title 'centered histogram';
run;
============
regular histogram Page 1 of 2
Y |
|
8 + * * * * *
7 + * * * * * * * * * * * * * * *
6 + * * * * *
5 + * * * * *
4 + * * * * * * * * * * * * * * * * * * * *
3 + * * * * * * * * * * * * * * *
2 + * * * * * * * * * *
1 + * * * * * * * * * * * * * * * * * * * *
0 + * * * * *
|
;--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
PCT
centered histogram Page 2 of 2
Y |
|
8 + * * * * * *
7 + * * * * * * * * * * * * * * * *
6 + * * * * * *
5 + * * * * * *
4 + * * * * * * * * * * * * * * * * * * * * *
3 + * * * * * * * * * * * * * * * *
2 + * * * * * * * * * * *
1 + * * * * * * * * * * * * * * * * * * * * *
0 + * * * * * *
|
;+---------+---------+---------+---------+---------+---------+-
0 5 10 15 20 25 30
PCT
The second chart has a different interpretation, the length of each bar
actually represent the frequency, x axis is less meaningful now.
Regards,
Ya Huang
Amy Lavis wrote:
>
> I've been asked to create a dot plot of the frequency of a single variable
> in the following form...
>
> Rate
> _____________________________________
>
> 100 *
> 90 **
> 80
> 70 ****
> 60 **
> 50
> 40 ******
> 30 *********
> 20 ******
> 10 **
> 0
> _____________________________________
>
> Aspirin for AMI
>
> This is the distribution of the rates for all hospitals using
> aspirin for AMI.
>
> Proc chart output was ok, but not centered like above. Any advice?
>
> Thanks!!
|