Data visualization with SAS programming

Bar Chart

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 132
Accepted Solution

Bar Chart

[ Edited ]

I have this dataset and I want to produce a bar chart like this 

 

 bar chart.PNG

Can you please help me with this my first time doing a bar chart

 

ObsSite_InitiatedSite_Approved1Date_Supplied4site_contracted
1396734

 

 


Accepted Solutions
Solution
‎04-09-2018 09:29 AM
Respected Advisor
Posts: 2,661

Re: Bar Chart

vbar Vname/type=sum sumvar=vvalue1234;
--
Paige Miller

View solution in original post


All Replies
Respected Advisor
Posts: 2,661

Re: Bar Chart

Explain what bar chart you want.

 

I don't see these variables as belonging on a single bar chart.

--
Paige Miller
Frequent Contributor
Posts: 132

Re: Bar Chart

Posted in reply to PaigeMiller

I just edited the question 

Respected Advisor
Posts: 2,661

Re: Bar Chart

[ Edited ]

There are a number of examples shown for PROC GCHART. Please give it a try and if you can't get it to work, show us your code.

 

http://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=graphref&docsetTarget=n1dvg3qp...

 

There are a number of examples show for PROC SGPLOT. See if any of those get's you the results you want.

 

http://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=graphref&docsetTarget=n1dvg3qp...

--
Paige Miller
Frequent Contributor
Posts: 132

Re: Bar Chart

[ Edited ]
Posted in reply to PaigeMiller

This is the chart that I got from changing the data structure and  using this code 

 

this is the dataset 

Obs Vname Vvalue1234

Site_Initiated39
Site_Approved16
Date_Supplied47
site_contracted34

 

this is the code 

proc gchart data=set5;

vbar Vname;

run;

 

this is the chart 

Capture set5.PNG

SAS Super FREQ
Posts: 1,048

Re: Bar Chart

change VBAR to VBAR3D in your PROC GCHART, and you should get a similar chart to your original post.

Respected Advisor
Posts: 2,661

Re: Bar Chart

Let me strongly un-recommend the 3D option. 

 

Just because you CAN make 3D bar charts with SAS software does not mean that you SHOULD make 3D bar charts. 3D bar charts are very difficult to interpret and often misleading.

--
Paige Miller
SAS Super FREQ
Posts: 1,048

Re: Bar Chart

Posted in reply to PaigeMiller

I do agree with Paige. If you want a 3-D'ish appearance on your bars without obscuring in the information, trying using a DATASKIN. Run this and see what you think:

 

data temp;
input measure $ 1-15 value;
cards;
Site_Initiated	 39
Site_Approved1	  6
Date_Supplied4	  7
site_contracted	34
;
run;

proc sgplot data=temp;
vbar measure / response=value dataskin=pressed;
run;
Frequent Contributor
Posts: 132

Re: Bar Chart

Thanks for your answer. This way worked too but I can't accept more than one answer. 

Solution
‎04-09-2018 09:29 AM
Respected Advisor
Posts: 2,661

Re: Bar Chart

vbar Vname/type=sum sumvar=vvalue1234;
--
Paige Miller
Frequent Contributor
Posts: 132

Re: Bar Chart

Posted in reply to PaigeMiller

I want to change the default here 

Do you have an idea how I can do it? Capture chart.PNG 

Respected Advisor
Posts: 2,661

Re: Bar Chart


@mona4u wrote:

I want to change the default here 

Do you have an idea how I can do it? Capture chart.PNG 


Use the LABEL statement.

--
Paige Miller
Frequent Contributor
Posts: 132

Re: Bar Chart

Posted in reply to PaigeMiller
Thanks.
I want to adjust the size and the location
because I'm creating a report and I want it to on the right of the table
Super Contributor
Posts: 273

Re: Bar Chart

Hi,
You probably would have an easier way to chart it, if you data set was structured like this

Measure Value
Site_Initiated 39
Site_Approved1 6
Date_Supplied4 7
site_contracted 34

 

Hope this helps,

Ahmed

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 13 replies
  • 276 views
  • 9 likes
  • 4 in conversation