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
Plot confidence interval for medianI'd appreciate if anyone could help me with this one. I need to plot median and percentile confidenc…
METAN command on log-transformed odds ratiosDear Statalist Member, I have several Effect Sizes (ES) with accompanied 95% Confidence Intervals (…
how to surpress the "graphs by group" when graphing histogram with by optionI do not want to display "graphs by group", Here is the code: Code: * Example generated by -dataex…
How to filter data using keywordsHi everyone, I am a novice user of STATA. I have collected execucomp data on excel, where manager d…
Seasonally adjusted GDPI guess this is a simple question. How to get the seasonally adjusted GDP continuously compounded g…
Subscribe to:
Post Comments (Atom)
0 Response to Bar Graph with multiples variables and categories
Post a Comment