--- Mike Schmitt <[email protected]> wrote:
> Currently, I have three dichotomous drug variables (drugA ,drugB, and
> drugC), each indicating whether a patient is prescribed a particular
> anti-hypertensive medication, and a fourth dichotomous variable
> (htnClass) that indicates that a patient has been prescribed drug A,
> B, or C. I also have a year variable, indicating the year in which
> the drug was prescribed. The data set is larger than just
> anti-hypertensives, so I wave hoping to create a line graph showing
> prescribing of these anti-hypertensives over time. However, I want
> to graph by row percent. Thus:
>
> if(htnClass==1), graph the row percents of drugA, drugB, and drugC by
> year.
Is this what you are looking for:
*------------------ begin example -------------------
// create some data
drop _all
input year drugA drugB drugC fw
1 1 0 0 10
1 0 1 0 20
1 0 0 1 15
1 0 0 0 100
2 1 0 0 15
2 0 1 0 20
2 0 0 1 15
2 0 0 0 110
3 1 0 0 10
3 0 1 0 25
3 0 0 1 15
3 0 0 0 120
4 1 0 0 10
4 0 1 0 25
4 0 0 1 15
4 0 0 0 150
5 1 0 0 15
5 0 1 0 20
5 0 0 1 15
5 0 0 0 90
end
expand fw
// prepare data for graph
collapse drugA drugB drugC if drugA==1 | drugB==1 | drugC==1, by(year)
// display graph
twoway line drug* year
*------------------- end example -------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/