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

st: RE: How do I draw graphs of injection history for 500 drug injectors ?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: How do I draw graphs of injection history for 500 drug injectors ?
Date   Thu, 29 Jan 2004 19:10:39 -0000

It sounds as if you want to cycle through the graphs. 

I'd do something like this, assuming numeric identifiers: 

levels injectorID, local(ID) 

foreach id of local ID { 
	twoway bar n_inj date if injectorID == `id', 
		subtitle(`id') saving(history`id') ysc(r(0,.)) 
	more 
} 

There is context at 
http://www.stata.com/support/faqs/data/foreach.html
	
Nick 
[email protected] 

André Jeannin
> 
> I have data on 500 drug injectors and their injection history:
> - injector identificator (injectorID)
> - for each injector: date of injection (date), number of 
> injections on 
> that day (n_inj). For the period under study, there are 
> between 2 and 200 
> days with injection(s) per injector.
> 
> In the the first step in the analysis of these data, I want 
> to do a visual 
> inspection of the injection profiles.
> 
> In stata this is what I want to do:
> 	by injectorID: graph twoway bar n_inj date, 
> saving(filename_based_on_injectorID)
> 
> This doesn't work because graph does not allow 'by:'
> Is it a clean and easy way to do this ?

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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