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:

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):

Using graph bar, over(Type) by(Subject) Stata gives me the relative proportions, but still in two graphs:

Any ideas of how to get what I need? Thanks!
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:
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):
Using graph bar, over(Type) by(Subject) Stata gives me the relative proportions, but still in two graphs:
Any ideas of how to get what I need? Thanks!
Comment