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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 626 views
  • 0 likes
  • 3 in conversation