How to Draw Graphs for One Continuous and One Categorical Variable? | Stata Tutorials Topic 12

Опубликовано: 09 Май 2026
на канале: Dr. Bob Wen (Stata, Economics, Econometrics)
476
15

Stata Tutorials Topic 12: Graphs for One Continuous and One Categorical Variable

Please download the course dataset for this video:
https://drive.google.com/file/d/1QZt_...

Hi, I am Bob. In Module 1, we learned to draw histograms and box plots for a continuous variable.
Today, let’s explore the distribution of a continuous variable for each category of a categorical variable. In
other words, we will draw graphs for one continuous variable and one categorical variable. For example, we
may want to find out how workers’ hourly wages are distributed across different levels of education. Here
the wage variable is continuous, and the education variable is categorical. In Stata, the “over” and “by”
options can be used with many graph commands to show the plots by groups.

The Stata commands in this video:
*use the course dataset
use "/Users/bobwen/Documents/10. Alison/Datasets/bob.dta", clear

*Histograms by groups
histogram hwage, by(educ)

*Box plots by groups
graph box hwage, over(educ) nooutsides

graph box hwage, by(educ) nooutsides

graph box hwage, over(gender) over(educ) nooutsides

*Bar charts by groups
graph bar (mean) hwage, over(educ)

graph bar (mean) hwage, by(educ)

graph bar (median) hwage, over(educ)

graph bar (median) hwage, over(gender) over(educ)


【Some courses on my Youtube channel 】
Economics in Real Life:
   • Economics in Real Life  

Solutions to Introductory Econometrics A Modern Approach 7th Edition:
   • Solutions to Introductory Econometrics A M...  

Introductory Stata:
   • Introductory Stata (2022)  

Introductory Microeconomics:
   • Introductory Microeconomics (2022)  

Five Minute Econometrics:
   • Five Minute Econometrics (Econometrics Tut...  

Five Minute Stata:
   • Stata Tutorials  

【國語Mandarin】生活中的經濟學:
   • 【Mandarin國語】現實生活中的經濟學  

【粵語Cantonese】生活中的經濟學:
   • 【Cantonese粵語】現實生活中的經濟學  

【粵語Cantonese】微觀經濟學基礎:
   • 粵語Cantonese微觀經濟學基礎2022  

【國語Mandarin】五分鐘計量經濟學:
   • 【Mandarin國語】五分鐘計量經濟學(計量經濟學輔導)  

【粵語Cantonese】五分鐘計量經濟學:
   • 【Cantonese粵語】五分鐘計量經濟學(計量經濟學輔導)  

On the Road:
   • On the Road  

#by #over #Stata #StataGraph #OneContinuousOneCategorical #tutorial