When we want to visualize the relationship between two categorical variables, we can use the stacked bar chart. Let's continue to use the dataset for US workers. You can download the dataset from the link below.
https://drive.google.com/file/d/1kAve...
************************
*44. Stacked Bar Chart *
************************
capture log close
log using stack.log, text replace
set showbaselevels on
*Use the dataset I created for US workers
use "https://134997773-924437014403349320....", clear
describe
summarize
*value label health variable
label define healthlabel 1 "Excellent" 2 "Very good" 3 "Good" 4 "Fair" 5 "Poor"
label values health healthlabel
tabulate health
*generate age goups
recode age (25/34=1 "25-34") (35/44=2 "35-44") (45/54=3 "45-54"), generate(agegroup)
*tabulate
tabulate health agegroup
*stacked bar chart
graph bar, over(health) over(agegroup) stack asyvars
graph bar, over(health) over(agegroup) stack asyvars percentage
graph hbar, over(health) over(agegroup) stack asyvars percentage
graph hbar, over(health) over(agegroup) stack asyvars percentage blabel(bar, pos(center) format(%3.0f)) ytitle(Percentage)
log close
【Free 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 Econometric...
Solutions to Microeconomics Theory and Applications with Calculus:
• Solutions to Microeconomics Theory an...
Stata Tutorials:
• Stata Tutorials
Five Minute Econometrics (Econometrics Tutorials):
• Five Minute Econometrics (Econometric...
Introductory Microeconomics:
• Introductory Microeconomics (2022)
Introductory Stata:
• Introductory Stata (2022)
Drum Covers:
• Drum Covers
【粵語Cantonese】現實生活中的經濟學:
• 【Cantonese粵語】現實生活中的經濟學
【國語Mandarin】現實生活中的經濟學:
• 【Mandarin國語】現實生活中的經濟學
【粵語Cantonese】微觀經濟學基礎:
• 粵語Cantonese微觀經濟學基礎2022
【粵語Cantonese】五分鐘計量經濟學(計量經濟學輔導):
• 【Cantonese粵語】五分鐘計量經濟學(計量經濟學輔導)
【國語Mandarin】五分鐘計量經濟學(計量經濟學輔導):
• 【Mandarin國語】五分鐘計量經濟學(計量經濟學輔導)
On the Road:
• On the Road
【Become a Supporter/Member of the channel ($2.99) to get PDF transcripts for】
1. Solutions to Microeconomics Theory and Applications with Calculus 5th Edition,
2. Solutions to Introductory Econometrics A Modern Approach 7th Edition,
3. Introductory Stata (2022),
4. Introductory Microeconomics (2022), and
5. Introductory Stata: Summary Statistics and Data Management
/ @bobwenecon
In addition to the videos on my YouTube channel, you can also learn Stata from my free Alison online courses.
Introductory Stata: Summary Statistics and Data Management
https://alison.com/course/introductor...
Introductory Stata: Graphics and Data Visualization
https://alison.com/course/introductor...
Watch video Introductory Stata 44: Graphs For Two Categorical Variables (Stacked bar chart) online without registration, duration hours minute second in high quality. This video was added by user Dr. Bob Wen (Stata, Economics, Econometrics) 22 February 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4,653 once and liked it 53 people.