Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nicolás Rojas <nicolas.srojas@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: How Can I Add Different Titles to Multiples Graphs Created in a Loop |
Date | Wed, 7 Apr 2010 14:30:26 -0400 |
Hello everyone, *I am making descriptive statistics from a data base about people who get sick and have to decide whether they go to an hospital or not within the last twelve months. Therefore, people can get sick of more than one sickness. * My problem is how to make pie graphs with a loop and put titles to every graph in the loop. *Thus, imagine I have 15 dummy variables indicating whether people go to a hospital for 15 different kind of sickness (say A, B, C D .. O ) . If they didn't get sick the variable has a missing value. then I could use the following: local sickness "A B C D ... O" foreach z of local sickness { graph pie, over (`z') saving(`z') } However, what I want to do is to put titles with the real name of the sickness while running the loop. That is, I want to put titles like Bronchitis for variable A Sinusitis for variable B etc. Obviusly it would be easy to write: local sickness "A B C D ... O" foreach z of local sickness { graph pie, over (`z') saving(`z') title(`z') } But the problem is that woud put titles that are not the real name of the variable (A B C instead of bronchitis sinusitis). I could rename the variables so thar instead of A B C they are named bronchitis sinusitis etc. The problem with that is that there are sickness that have compund names so the would be named, for example, common_cold . I don't want to have graphs with titles that have an underscore. Also, as people can get more than one sickness by() and labels would not help either. Does anybody know what to do?? Thanks, Nicolas Rojas Pontifical Catholic University of Chile * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/