BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
xxformat_com
Barite | Level 11

Hi,

do you know the thought when SAS created vbar and vbarparm statements in proc sgplot?

 

Was the vbar statement the first version ?

And then a new version was build using vbarparm to gain in flexibility?

 

I can see some features only available in vbarparm but I don't know if there is anything done with vbar which cannot be done with vbarparm.

 

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

VBAR is a pretty direct descendant of older Proc Gchart bar charts.

The VBARPARM is intended to work with summarized data and not do the summary in the procedure. So you control the vertical hold, you control the horizontal  (enough Outer Limits parody). But because you control the summaries you may have to specify things that the calculations in VBAR would provide, or specify them differently because you have to provide variables in the graphing data set.

 

Vbar and Vbarparm basically differ in the data sets used and that is where the difference comes in. Need the height of one bar to be different because some records of a specific group with complex rules need to be excluded for whatever reason? Vbar won't likely do that in a nice fashion (a Where statement may work but you might spend much time getting it not to effect other values needed for the plot). Do that in creating the set used by Vbarparm.

Rates with desired numerator/denominators can be tricky as well in Vbar.

 

You may trade off some data step programming for graph code with Vbarparm (and Hbarparm).

 

Note: when Gchart was all there was in SAS I summarized the data before other than exploratory graphs because the defaults almost never did what I wanted or I spent a lot of time playing with interactions between options. I find it easier to see a value in a data set or print output that can match to points/ bars/ lines on a graph to double check whether everything was applied as intended.

 

View solution in original post

7 REPLIES 7
DanH_sas
SAS Super FREQ

The key difference between VBAR and VBARPARM is that VBAR can compute various statistics for both your bar and the bar limits, whereas VBARPARM draws the bar and limits using only the data provided. Due to the work it does, the VBAR statement is limited to the types of plot overlays that can be used with it, but VBARPARM can be combined with a lot more overlays to make more creative plots.

 

Which plot you use depends on your goal. If you have pre-summarized your data, you should always use VBARPARM, as it gives you the most rendering flexibility and you do not require the statistics computations. If your data is not summarized, and your are creating single bar charts, multiple bar overlays, or bar-line charts, then VBAR is a better option. If you need a more creative plot, but still need your data summarized, it might be best to pre-summarize your data using PROC MEANS or PROC SUMMARY and use a VBARPARM.

 

Hope this helps. Let me know if you have any more questions about it.

 

Thanks!

Dan

ballardw
Super User

VBAR is a pretty direct descendant of older Proc Gchart bar charts.

The VBARPARM is intended to work with summarized data and not do the summary in the procedure. So you control the vertical hold, you control the horizontal  (enough Outer Limits parody). But because you control the summaries you may have to specify things that the calculations in VBAR would provide, or specify them differently because you have to provide variables in the graphing data set.

 

Vbar and Vbarparm basically differ in the data sets used and that is where the difference comes in. Need the height of one bar to be different because some records of a specific group with complex rules need to be excluded for whatever reason? Vbar won't likely do that in a nice fashion (a Where statement may work but you might spend much time getting it not to effect other values needed for the plot). Do that in creating the set used by Vbarparm.

Rates with desired numerator/denominators can be tricky as well in Vbar.

 

You may trade off some data step programming for graph code with Vbarparm (and Hbarparm).

 

Note: when Gchart was all there was in SAS I summarized the data before other than exploratory graphs because the defaults almost never did what I wanted or I spent a lot of time playing with interactions between options. I find it easier to see a value in a data set or print output that can match to points/ bars/ lines on a graph to double check whether everything was applied as intended.

 

Jay54
Meteorite | Level 14

There is one other flavor called VBARBASIC, which follows the GTL BarChart features.  It summarizes the data by group and class, but does not have the additional "GCHART" like features.  Thus, you can combine it with more plot types.

xxformat_com
Barite | Level 11
Thank you @Jay54
xxformat_com
Barite | Level 11
Style... keywords used in proc sgplot and proc template are not always the same, making it tricky to remember everything and transfert one sgplot graph to a more generic solution.

Does vbarbasic offer the more similarities between the two?
xxformat_com
Barite | Level 11
Thank you @ballardw

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 1525 views
  • 12 likes
  • 4 in conversation