BookmarkSubscribeRSS Feed
marysmith
Calcite | Level 5

Dear community,

 

i am struggeling again and need your help!

 

i have to compare my results with the results from a former study and I have to visualize the differencies with a barchart.

For my Study I have a big dataset and that went fine, but for creating a barchart for the other studie I only have the results not the whole dataset. I tried create a new dataset with the results from the other studie and tried to create a barchart as well but it didnt work.

So does anybody know if its even possible to draw a barchart wih those informations and how to do that?

in the end i need a barchart or something that looks like one with those informations.

Unbenannt.JPG

This is how its supposed to look 🙂

 

year   Numberofstudies Number of doctors  Number of patients  Number ofunique drugs   No. of sponsors
2008   185                         41834                          368481                            154                          92
2009   185                         41961                          349424                            154                          98

2010   188                         42967                          359147                             152                          90



DATA datensatz_0810; INPUT year Numberofstudies doctors patients uniquedrugs sponsor; DATALINES; 2008 185 41834 368481 154 92 2009 185 41961 349424 154 98 2010 188 42967 359147 152 90 ; RUN; proc sgplot data=datensatz_0810; yaxis label="Numberofstudies" max=200; vbar year / barwidth=0.5; title 'Number of studies per year'; run;



2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Do something like this

 

data have;
input year Numberofstudies Numberofdoctors Numberofpatients Numberofuniquedrugs Numberofsponsors;
datalines;
2008 185 41834 368481 154 92
2009 185 41961 349424 154 98
2010 188 42967 359147 152 90
;

title "Number Of Studies Per Year";
proc sgplot data=have;
   vbar year / response=Numberofstudies fillattrs=(color=green) barwidth=0.5;
   yaxis min=0 max=200 label="Number of studies";
run;
title;
Rick_SAS
SAS Super FREQ

Add the FREQ= option to specify that each observation actually represents more than one count:

 

vbar year / freq=Numberofstudies;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1009 views
  • 0 likes
  • 3 in conversation