Date: Fri, 27 Oct 2006 10:26:44 -0400
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: Axis label in gchart
In-Reply-To: <88943EBB64C95844B8DEE5C9F40CDF56BC771A@somc2.somc.uq.edu.au>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I would visit the support.sas.com you might find a nice alternate
solution there.
You can use your data to write the statement(s) you need. Here is a
way using _file_ magic to create a macro variable I called TICK. You
may find it useful.
proc plan seed=112358;
factors
year = 1 ordered
month = 12 ordered
count = 1 of 50 random
/ noprint
;
output out=work.a year nvals=(2006) ordered;
run;
proc sort data=a;
by year month;
run;
ods listing close;
ods output OneWayFreqs=freqout;
proc freq data=a;
by year month;
table count;
weight count;
run;
ods output close;
ods listing;
filename dummy dummy lrecl=32767;
data freqout;
file dummy;
set freqout end=eof;
date=mdy(month,1,year);
format date monyy5.;
length mmm $3 yyyy $4.;
mmm = putn(date,vformat(date));
yyyy = put(year,4.);
tick + 1;
retain justify 'C';
put tick= justify= mmm :$quote5. justify= yyyy:$quote6. @;
if eof then call symput('TICK',trim(_file_));
run;
%put NOTE: TICK=&tick;
On 10/27/06, Craig Hansen <C.Hansen@uq.edu.au> wrote:
> Dear All
>
> I have data for admissions to a clinic and based on a date variable I am
> wanting to plot how many patients entered the clinic for each month over
> a period of time that covers Nov 2005 to Aug 2006. I have used the
> program below, which is fine, however because the major ticks on the
> maxis are dates (eg. NOV05, DEC05...AUG06 etc) the font size has to be
> small for them to fit along the maxis. To overcome this I used tick=1
> 'NOV' justify=c '2005.....tick=10 'AUG' justify=c '2006', but I am
> wondering if there is an option where the dates on the maxis can be put
> on two lines (similar to the DOWN=2 option in a legend statement). I
> will run this plot every month as new admissions are added to the data
> so I don't want to have to type in the tick/justify options everytime
> for the new months.
>
> Here is the program I used:
>
> proc sort data=a;
> by year month;
> ods output OneWayFreqs=freqout;
> proc freq data=a;
> by year month;
> table count;
> run;
> ods output close;
> data freqout; set freqout;
> dummy=1;
> date=mdy(month,dummy,year);
> format date monyy5.;
> run;
> goptions reset=all htext=1.2 ftext=swissb;
> axis1 label = (angle=90 c=black h=1.7 'Frequency');
> axis2 label = (h=1.7 'Date') value=(tick=1 'NOV' justify=c '2005'
> tick=2 'DEC'
> justify=c '2005'
> tick=3 'JAN'
> justify=c '2006'
> tick=4 'FEB'
> justify=c '2006'
> tick=5 'MAR'
> justify=c '2006'
> tick=6
> 'APR' justify=c '2006'
> tick=7
> 'MAY' justify=c '2006'
> tick=8
> 'JUN' justify=c '2006'
> tick=9
> 'JUL' justify=c '2006'
> tick=10
> 'AUG' justify=c '2006');
> proc gchart data=freqout;
> vbar date/discrete sumvar=frequency maxis=axis2 raxis=axis1 outside=sum
> ;
> run; quit;
>
>
> The other option was to use 'vbar month/discrete sumvar=frequency
> GROUP=year' but it shows other months in 2005 and 2006 where there are
> no entries. I want it to start at NOV2005 and finish AUG2006.
>
>
>
> Thanks in advance for any help
> Craig
>