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/