Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: percentage for each month plotted vs. month

From   [email protected]
To   <[email protected]>
Subject   st: percentage for each month plotted vs. month
Date   Mon, 2 May 2005 09:13:47 -0500

I have the following survey data of 1000 patients collected over 15 
Each observation contains the following variables: 
X:  "1" for using drug x and "2" for not using drug x 
DATE: Day and month patient was enrolled in study (variable DATE as day 
month year) 
Adult: "1" yes "2" no 
I would like to plot the percentage of patients who were using drug x in a 
given month  vs. month & year. So the axes would be Y: "percent of 
patients using drug x in given month" and X axis: "month & year of 
I cannot seem to figure out an easy way to do this.  It seems that I have 
to generate many variables to get a simple percentage of patients who were 
using drug x for that particular month and then to plot it. 
Also, I would like to get more sophisticated as well: the same graph as 
above but have two lines on one graph; one line would represent the data 
for children and the other for adults. 
Also, I'd like to generate many graphs using the do editor (same as above 
for other drugs).  When I try using the do editor this, I get one graph 
and then the next is shown and I get to save only the last.  Is there a 
way I could run several graphs using the do editor and then save them all 
so that I could view them leisurely? 
I have a copy of Mitchell's excellent book on STATA graphics and still 
can't figure this out!
Appreciate any suggestions. 
Richard Lenhardt
Rush University 

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index