BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jim_Cooper_hmsa
Obsidian | Level 7

I have been running report that produces a bar chart of the daily COVID-19 hospital admissions from March 15 2020 to current.  The bar chart stops displaying dates after July 14, 2021.  Is there a limit to the number of bars that can be displayed in a VBAR chart? 

Is there an option that will allow me to display the whole time line from March 15 2020 for the forseeable future or do I have to start sampling the data points?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

It won't hurt to show your code.

 

If you are using an option to force a tick mark for every date that might limit things.

 

I would typically use a Needle plot to show a large number of values like this.

Example creating some dummy count data per day and displaying it.

data example;
  do date='01Jan2020'd to '31DEC2021'd;
     value= rand('integer',100);
     output;
  end;
  format date date9.;
run;

Proc sgplot;
   needle x= date y=value;
run;
   
 

View solution in original post

4 REPLIES 4
ballardw
Super User

It won't hurt to show your code.

 

If you are using an option to force a tick mark for every date that might limit things.

 

I would typically use a Needle plot to show a large number of values like this.

Example creating some dummy count data per day and displaying it.

data example;
  do date='01Jan2020'd to '31DEC2021'd;
     value= rand('integer',100);
     output;
  end;
  format date date9.;
run;

Proc sgplot;
   needle x= date y=value;
run;
   
 
Jim_Cooper_hmsa
Obsidian | Level 7

Here is the PROC SGPLOT statement that I am using.  The data is 403 observations for admissions from March 15, 2020 - August 15, 2021. The last data point in chart is July 21,2021

proc sgplot data=CovidAdmitSummary;
vbar CovidAdmitDT /response=Admissions nooutline barwidth=.7 missing;
xaxis fitpolicy=rotatethin interval=day ;
yaxis label='# Admissions' max=20 grid gridattrs=(color=lightblue pattern=1 thickness=.5);
format CovidAdmitDT date5.;
label CovidAdmitDT='Day of Admission';
run;

Jim_Cooper_hmsa_0-1629155816094.png

 

ballardw
Super User

It is extremely easy to test the needle plot.

Change your code to read

needle x=CovidAdmitDt y=Admissions;

instead of the VBAR you are currently using.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 4 replies
  • 1063 views
  • 2 likes
  • 3 in conversation