BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Babloo
Rhodochrosite | Level 12

Could you please guide me to create a similar chart in proc report or proc tabulate or proc freq?

Reeza
Super User

PROC REPORT or TABULATE do not generate charts. 

PROC FREQ can, but I don't think it does the chart you want so without a SAS/GRAPH or SGPLOT license you're possibly out of luck.

 

I'm assuming you're on a SAS version less than 9.3 though, which is about a decade old at this point. I'll also assume you're recommending that your company upgrade to SAS 9.4. 

 

If you must have a graph, I would recommend using Excel and DDE and then output to PDF or whatever you needed but its obviously a workaround and a lot more work. Or a different language you have access to, such as R or Python. 

Reeza
Super User

This is what I got with PROC FREQ - you can customize variables using labels. I believe any more changes to styes would need to happen via a template modification which is more time that I have to spend on this issue. It could likely be done. I'm not sure this works on SAS 9.1 but should work on 9.2+.

 

proc transpose data=temp out=temp2;
by name;
var Avg_Talk_Time_Answered_Calls Avg_ACW_Time_Answered_Calls;
run;

proc freq data=temp2;
table _name_*name / plots=freqplot( twoway=grouphorizontal);
weight col1;
run;
DanH_sas
SAS Super FREQ

@JeffMeyers gave a great solution for using SGPLOT. I thought I would take his program and show another variation using SGPANEL:

 

data test;
  length name average_talk_time_answered_calls Average_ACW_Time_Answered_Calls $200;
  name='Van der Haeghen, Wendye (E003983)';
  Average_Talk_Time_Answered_Calls='116,3953488';
 Average_ACW_Time_Answered_Calls='290,4883721';output;
  name='Verhaeghe, Johny (E002902)';
  Average_Talk_Time_Answered_Calls='86,66666667';
  Average_ACW_Time_Answered_Calls='2,333333333';output;
;
run;

data temp(drop=Average_Talk_Time_Answered_Calls Average_ACW_Time_Answered_Calls) ;
set test;
Avg_Talk_Time_Answered_Calls=input(tranwrd(Average_Talk_Time_Answered_Calls,',','.'),best.);
Avg_ACW_Time_Answered_Calls=input(tranwrd(Average_ACW_Time_Answered_Calls,',','.'),best.);
run;

data plot;
    set temp;
    length category $100.;
    category='Average Talk Time Answered Calls';time=Avg_Talk_Time_Answered_Calls;output;
    category='Average ACW Time Answered Calls';time=Avg_ACW_Time_Answered_Calls;output;
run;

ods graphics / reset width=10in;
title 'Avg Talk Time (sec), ACW Talk Time (sec) Calls Answered';
proc sgpanel data=plot;
     panelby name / onepanel layout=columnlattice colheaderpos=bottom novarname;
     vbar name / response=time group=category groupdisplay=cluster grouporder=descending;
     keylegend / title='';
     rowaxis min=0 max=350 values=(0 to 350 by 50) offsetmin=0 offsetmax=0
             grid gridattrs=(color=black pattern=solid) display=(nolabel);
     colaxis display=none offsetmin=0.3 offsetmax=0.3;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 18 replies
  • 1940 views
  • 1 like
  • 8 in conversation