Hello everyone,
I'm new to the Forum and relatively beginner at Stata, so sorry if the answer for what I am looking for is too obvious. I need to create a bar chart of two categorical variables: one is Subject (Math or History) and other is Type (A, B, C, or D). My data is structured as follows (example):
Subject Type
Math A
Hist A
Hist B
Math C
Hist C
Hist C
Hist D
Hist A
Hist A
Math A
Math A
Math A
Math C
Math C
Hist D
Math D
Math A
I'm looking for a command that will visually give me the percentage of each type, by subject, in one single graph. I'm looking for something like this:
Array
If I do graph bar, over(Type) over(Subject), not only I end up with two graphs, one for each subject, but also Stata does not separately calculate the percentage for each Subject (in my database I have many more Math observations than History):
Array
Using graph bar, over(Type) by(Subject) Stata gives me the relative proportions, but still in two graphs:
Array
Any ideas of how to get what I need? Thanks!
Related Posts with Graphing two categorical variables
F test values are missing, I tried to understand it from the previous post but could not get it.I am very new stata, please pardon me if i sound stupid. I rana regression with xtreg fixed effect w…
interflex command failedHello everyone, I have a problem with the results of the interflex command. I had tried to look if …
Converting ExcelI need to import 3 excel files with different columns/rows into Stata. Excel #1 looks like this: …
update available of abm_grid: A Mata class for managing a square grid for agent based modelsAn update of the abm_grid class is now available on GitHub: https://github.com/maartenteaches/abm_gr…
Difference in Difference Parallel Trends testDear Statalisters, I am running a Difference in Difference analysis. In order to test whether treat…
Subscribe to:
Post Comments (Atom)
0 Response to Graphing two categorical variables
Post a Comment