Hi, everyone!
I need to perform a bar graph with 2 variables containing 4 categories each.
The 2 variables are treat1 and treat2.
The categories were labeled as: 1 == "lowdose" 2 == good_treat 3 == "overdose" 4 == nd.
I want a vertical bar graph demonstrating the percentage of treat1 and treat2 for each category (lowdose, good_treat, overdose and nd).
That is, the 4 categories on x axis and each category with 2 bars (treat1 and treat2 percentages).
I'm really sorry! I've searched it on previous posts about the same issue (like "how to graph bar of categorical variables", "A simple graph bar" and "(possibly) simple bar graph comparing two variables (not one variable over the other)", but I didn't make it as I wish using those informations.
That is an example of my data:
list treat1 treat2
+---------------------+
| treat1 treat2 |
|---------------------|
1. | 1 2 |
2. | 2 4 |
3. | 2 2 |
4. | 2 2 |
5. | 4 2 |
|---------------------|
6. | 4 1 |
7. | 4 3 |
8. | 1 2 |
9. | 1 2 |
10. | 1 2 |
|---------------------|
11. | 4 1 |
12. | 3 4 |
13. | 2 4 |
14. | 4 2 |
15. | 4 4 |
|---------------------|
16. | 2 2 |
17. | 2 4 |
18. | 4 2 |
19. | 2 2 |
20. | 2 2 |
|---------------------|
21. | 2 1 |
22. | 4 2 |
23. | 4 3 |
24. | 2 1 |
25. | 1 2 |
|---------------------|
26. | 3 1 |
27. | 2 2 |
28. | 2 2 |
29. | 1 2 |
30. | 1 2 |
|---------------------|
31. | 2 2 |
32. | 2 1 |
33. | 3 4 |
34. | 2 3 |
35. | 1 2 |
|---------------------|
36. | 2 2 |
37. | 2 2 |
38. | 1 1 |
39. | 4 2 |
40. | 2 2 |
|---------------------|
41. | 2 4 |
42. | 4 2 |
43. | 4 1 |
44. | 2 3 |
45. | 2 2 |
|---------------------|
46. | 4 3 |
47. | 2 2 |
48. | 2 2 |
49. | 3 4 |
50. | 2 1 |
|---------------------|
label values treat1 origin
label def origin 1 "lowdose", modify
label def origin 2 "good_treat", modify
label def origin 3 "overdose", modify
label def origin 4 "nd", modify
label values treat2 origin
label def origin 1 "lowdose", modify
label def origin 2 "good_treat", modify
label def origin 3 "overdose", modify
label def origin 4 "nd", modify
I thank in advance for the help!
Related Posts with Bar Graph with multiples variables and categories
Stone geometric price index in stataHi Statalists, Does anyone know how to compute the Stone geometric price index in stata? …
calculating a formula in stataHello everyone I have a sample of 100 rnormal() in stata, am going to calculate this formula in stat…
Problems with Panel Data AnalysisHello everyone, I'm dealing with panel data analysis and still confused about few things I have a t…
Clever appendHi Statalisters, hope to find you all well. So, the problem is the following. I have two large pan…
Removing duplicate matchesHi, I have used vmatch to match my control group to my treatment group based on two characteristics…
Subscribe to:
Post Comments (Atom)
0 Response to Bar Graph with multiples variables and categories
Post a Comment