Data visualization with SAS programming

add date to x axis

Reply
Contributor
Posts: 73

add date to x axis

Hello everyone!

I would like to add the date to the x axis in the below code, how would i do that?
Basically i would like to see in x axis each day in the date range and the Call_type, Sum of Calls_handled in y axis.


proc chart data = Call_type_technical;
VBAR Call_type /SUMVAR = CALLS_HANDLED TYPE= SUM;
run;

Thanks

Fred
SAS Employee
Posts: 980

Re: add date to x axis

Perhaps something like this...

proc chart data = Call_type_technical;
VBAR date / discrete
subgroup=Call_type
SUMVAR=CALLS_HANDLED TYPE= SUM;
run;
Contributor
Posts: 73

Re: add date to x axis

Thanks Robert

Is it possible to have a bar for each Call_type instead of on top of each other?

Fred
SAS Employee
Posts: 980

Re: add date to x axis

You could use a 'grouped' bar chart (but there are some caveats you might run into)...

The code would be something like:

proc chart data = Call_type_technical;
VBAR Call_type / discrete
group=date
SUMVAR=CALLS_HANDLED TYPE= SUM;
run;
Contributor
Posts: 73

Re: add date to x axis

Thank you Robert this will help a lot with my analysis.

Fred
SAS Super FREQ
Posts: 8,819

Re: add date to x axis

Just curious...won't PROC GCHART look better???

;-)
cynthia
Contributor
Posts: 73

Re: add date to x axis

Hi Cynthia

Yes that is what i ended up doing, see code below.
Thanks for the input.

/* Technical Set the graphics environment */
/* Create Graph of Calls Handled Technical */

/* Email HTM File to Distribution List */
goptions reset=all device=activex xpixels=950;


/* Specify the path and filename of the output file. */

filename odsout '\\***************************************\';


/* Open the ODS HTML output destination */

ods html file='Information.html' path=odsout style=Statistical;


title 'Information';

/* use the SHAPE= option to specify a cylinder */

axis1 value=(height=8pt angle=90);
axis2 label=(angle=90 rotate=0);

proc gchart data=Call_Type_Tech noprint;
vbar3d date /width =10 sumvar=calls_handled discrete raxis=axis1 shape=cylinder
subgroup=call_type
group=call_type
cframe=yellow autoref width=2;
run;
quit;

Fred
SAS Super FREQ
Posts: 8,819

Re: add date to x axis

Hi:
Are you getting an error on the NOPRINT option?
[pre]
527 proc gchart data=xxxxxxx_yyyyyyy noprint;
-------
22
202
ERROR 22-322: Syntax error, expecting one of the following: ;, (, ANNOTATE, DATA, GOUT, IMAGEMAP.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
[/pre]

Other than that, the CFRAME=YELLOW hurts my eyes, but perhaps your viewers have younger eyes that aren't as sensitive to colors like that.

cynthia
Contributor
Posts: 73

Re: add date to x axis

I have since removed the noprint.

I do have a question regarding Goption Device = gif;
instead of goption reset = all device = active x;

I have changed my code to Goption Device = gif; so i could drilldown but it now appears that i can't hover over bars with my mouse and see the totals for each group were this was the case with goption reset = all device = active x;

Code below

goptions device=gif gsfname=image gsfmode=append display;
ODS LISTING CLOSE;

/* Specify the path and filename of the output file. */

filename odsout '\\mtrl\Int_ss$\vali_esource_vs_destination\';


/* Open the ODS HTML output destination */

ods html file='Calls Handled.html' path=odsout style=Statistical;


title 'Calls Handled ';
footnote1 color=Black "(Click Blue #1 Drilldown to Technical #2 Green for Service #3 Yellow for Sales & Retention)";
footnote2 color=Red "(# 4 Calls that are not assigned to Group, no drilldown available)";

/* use the SHAPE= option to specify a cylinder */

axis1 value=(height=8pt angle=90);
axis2 label=(angle=90 rotate=0);

proc gchart data=neworg_callshandle_by_day;
vbar3d date /discrete subgroup = color width =10 sumvar=calls_handled discrete raxis=axis1 shape=cylinder
subgroup=Group
maxis=axis1
raxis=axis2
autoref cref=gray
clipref
coutline=black
legend=legend1
html_legend=htmlvar
cframe=white autoref width=2;
run;
quit;

ods html close;

Any suggestions as it would be good to see that info

thanks

Fred
Super Contributor
Super Contributor
Posts: 3,174

Re: add date to x axis

You need HTML= parameter and add corresponding SAS variable from your input file to display the ALT= text.

Sample 25247: Produce a graph with chart tips and drill down capabilities
http://support.sas.com/kb/25/247.html


Scott Barry
SBBWorks, Inc. Message was edited by: sbb
Ask a Question
Discussion stats
  • 9 replies
  • 264 views
  • 0 likes
  • 4 in conversation