DATA Step, Macro, Functions and more

How to make a sgplot or barcharts with this data?

Reply
Contributor
Posts: 57

How to make a sgplot or barcharts with this data?

[ Edited ]

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 Smiley Happy

 

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;



PROC Star
Posts: 1,400

Re: How to make a sgplot or barcharts with this data?

[ Edited ]
Posted in reply to marysmith

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;
SAS Super FREQ
Posts: 4,267

Re: How to make a sgplot or barcharts with this data?

Posted in reply to marysmith

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

 

vbar year / freq=Numberofstudies;

Ask a Question
Discussion stats
  • 2 replies
  • 38 views
  • 0 likes
  • 3 in conversation