- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to plot a bar graph using SAS, and so far I have the following code:
DATA auto ;
INPUT resource $ percent ;
CARDS;
Google 73.6
Library 13.6
Wikipedia 9.4
Other 3.4
;
TITLE 'Simple Vertical Bar Chart ';
PROC SGPLOT DATA=auto;
vbar resource;
run;
quit;
I am using the student version of SAS provided free through my university hence the usage of SGPLOT. When I run the code, however, instead of showing the percentages of each resource, it plots the frequencies so all the bars show as 1 unit length. I am trying to plot resources, the independent variable, vs the percentage, the dependent variable. I tried using vbar resource/ DISCRETE, but received an error message stating that I can only use DISCRETE to offset the bins. I would appreciate any tips and additional resources to consult as I am new to SAS. Thank you!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
DATA auto ;
INPUT resource $ percent ;
CARDS;
Google 73.6
Library 13.6
Wikipedia 9.4
Other 3.4
;
TITLE 'Simple Vertical Bar Chart ';
PROC SGPLOT DATA=auto;
vbar resource/respose=percent datalabel nostatlabel;
run;
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
DATA auto ;
INPUT resource $ percent ;
CARDS;
Google 73.6
Library 13.6
Wikipedia 9.4
Other 3.4
;
TITLE 'Simple Vertical Bar Chart ';
PROC SGPLOT DATA=auto;
vbar resource/respose=percent datalabel nostatlabel;
run;
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your response!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Welcome to the SAS communities 🙂
Please see se blog post Getting started with SGPLOT for an introduction to the VBAR Statement in PROC SGPLOT.