Using Stata to Create Bar Graphs

preview_player
Показать описание
Bar graphs provide a way to examine a continuous or quantitative measure across one or more discrete measures. In this video see how to create simple bar graphs and learn about the over suboption in Stata.
Рекомендации по теме
Комментарии
Автор

Hello, thanks for the useful video. 2 questions: 1) How did you get the bars to be different colors in the last graph? 2) How can I change the color of a single bar? TIA

SkiBumK
Автор

Hi man! Thanks a lot, it was very useful!! Greetings from Colombia!

paulonieto
Автор

hi! there is a way to make a bar graph on stata without making the mean(or median)? I only want to plot my data, hist doesn't work because I have the mean and the median of two variables to plot over a string variable. With graph bar stata plots the mean of the mean and the mean of the median. How I can solve it? Thanks

beatriceruocco
Автор

Hello, great video, thank you!
I have a really simple question, I would like to graph means and sd bars for several different variables (over country, where I compare the country mean for one country with other countries in the study) on one chart for each variable.
if you have time to help me with the code, I would be very grateful.

GillTokyo
Автор

How would you go about producing bar charts with percentages as opposed to the mean or percentiles

kennah
Автор

/*
Using Stata to create bar graphs
*/

/* Basic bar graph examples - Summarize the mean */
summarize realrinc
graph bar realrinc, name(bar1, replace) // Start with a default graph and add options.

tabstat realrinc, by(marital)
graph bar realrinc, over(marital) name(bar2, replace) //

/* Using multiple -over()- options */
graph bar agewed, over(divorce) over(sex) name(box1, replace)
graph bar agewed, over(sex) over(divorce) name(box2, replace)
graph bar agewed, over(sex) over(divorce) name(box2, replace) asy // as y variable
graph hbar agewed, over(sex) over(divorce) name(box2, replace)

/* Relabeling */
#delimit ;
graph bar agewed, over(sex, relabel(1 "Men" 2 "Women")) // Note relabel within over.
over(divorce, relabel(1 "Divorced" 2 "Not divorced"))
name(bar1, replace);
#delimit cr

/* Displaying different statistics */
#delimit ;
graph bar (p75) agewed, over(sex, relabel(1 "Men" 2 "Women"))
over(divorce, relabel(1 "Divorced" 2 "Not divorced"))
name(bar1, replace);
#delimit cr

/* Example of a polished graphic */
#delimit ;
graph bar agewed, over(sex, relabel(1 "Men" 2 "Women"))
over(divorce, relabel(1 "Divorced" 2 "Not divorced"))
bargap(10)
title("Age When First Married by Gender and Ever Divorced", span)
ytitle("Age")
note("Source: General Social Survey, 2006")
ymtick(10(5)40)
legend(col(1) ring(0) position(1))
graphregion(color(white))
name(box4, replace);
#delimit cr

librarystudyntour
Автор

Anyboyu know how you can add the IQR after computing median bar graph?Thanks alot

mantshonyanelent
Автор

Hi ... I would like to know how to superimpose the bar graphs. Any help in this regard is highly appreciated

bruhankm
Автор

Very useful video. 

I do have a question. How can you graph a bar with percentage instead of means?

gonzalyu
Автор

i dont get it, what if I need just a single categoric variable? how to do a graph bar?

juliorivas
Автор

Help! I need to be able to use error bars with bar graphs. Thanks :)

claire
Автор

how do I can add the SD to a mean bar graph?

sonoman
Автор

It's usefull, thank you! I have a question: how can I add to my graph the stars of significance? In fact between the symbols I found there aren't any stars...

lauradagostini
Автор

Anybody out there knows what does "asis" works for?

danieldelahormaza
Автор

#delimit ;
graph bar Agewed, over(Sex,    relabel(1 "Men" 2 "Women"))
      over(Divorced, relabel(1 "Divorced" 2 "Never divorced")
  bargap(10)
  asy
  title("Average Age First Married by Gender and Ever Divorced", span)
  ytitle("")
  note("Source: General Social Survey, 2006")
  ymtick(10(5)25)
  legend(col(1) ring(0) position(11))
  graphregion(color(white))
  name(bar4, replace);
#delimit crWhat's wrong with my syntax - I tried so many times but it keeps saying - parentheses do not balance

PeniHausia