Thanks a lot Nick,
that was really interresting! I used a silly (though
working for a ... finite number of names) solution
with multiple if's but yours is very elegant. About
while vs. forval ... I know, but some habits are hard
to break.
Thanks again for you time
Nikos
--- Nick Winter <[email protected]> wrote:
> You can build up your graph command within a loop as
> well -- something like:
>
>
> local gcmd sc a b c Y,xlabel( ,val ) c(l
> l l )
> forvalues i=1/`r(tokens)' {
> local gcmd `gcmd' || sc pos`i' Y , ms(i)
> mlabpos(0)
> mlabel(names_`i')
> }
>
> Then just issue the graph command:
>
> `gcmd'
>
> Hope this helps. By the way, instead of a -while-
> loop, -forvalues- is
> easier to code and more transparent. But both work.
>
> --Nick Winter
>
>
> At 07:19 AM 7/8/2004 -0700, you wrote:
> >Thanks Nick,
> >
> >No it's one course per plot but lots of such plots
> to
> >be produced. Anyway, while I was waiting for
> responses
> >I tried to find a solution and I ended up with
> >something that looks similar to your solution (I
> used
> >the vtokenize to ... tokenize names)
> >
> >sum a
> >local ma=r(max)
> >sum b
> >local mb=r(max)
> >sum c
> >local mc=r(max)
> >vtokenize names
> >
> >local i=1
> >while(`i'<=real(r(tokens))){
> > gen pos`i'=max(`ma',`mb',`mc')+`i'/4
> > local i=`i'+1
> > }
> >
> >sc a b c Y,xlabel( ,val ) c(l l l ) || sc pos1
> >Y,ms(i) mlabpos(0) mlabel(names_1)
> xscale(range(0.5
> >6.5)) /*
> >*/ || sc pos2 Y,ms(i) mlabpos(0) mlabel(names_2) /*
> >*/ || sc pos3 Y,ms(i) mlabpos(0) mlabel(names_3) /*
> >*/ || sc pos4 Y,ms(i) mlabpos(0) mlabel(names_4) /*
> >*/legend(order(1 2 3) row(1))
> >
> >The only problem now is that I don't know the
> number
> >of instructors a priori thus the number of
> additional
> >scatter commands (sc pos* Y) must be manually
> modified
> >for each course-dataset-plot. I used the returned
> >result r(tokens) to generate the positions but I
> can't
> >figure out how to deal with the multiple scatter
> >commands.
> >
> >Thanks again for your help
> >
> >Nikos Pantazis
> >Biostatistician
> >
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Yahoo! Mail - 50x more storage than other
> providers!
> >http://promotions.yahoo.com/new_mail
> >*
> >* 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/
>
>
--------------------------------------------------------
> Nicholas Winter
> 607.255.8819 t
> Assistant Professor
> 607.255.4530 f
> Department of Government
> [email protected] e
> 308 White Hall
> falcon.arts.cornell.edu/nw53 w
> Cornell University
> Ithaca, NY 14853-4601
>
>
> *
> * 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/
>
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
*
* 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/