Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Syntax for options in a program


From   philippe van kerm <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Syntax for options in a program
Date   Thu, 14 Aug 2008 09:18:54 +0200

I'm not sure it this is the main or only source of problem, but your -foreach- statements are not correct:

     foreach `q' of local `_byvars' {;

should be

     foreach q of local _byvars {;

and

     foreach i of local `varlist' { ;

should be

     foreach i of local varlist { ;

Philippe



> -----Message d'origine-----
> De : [email protected] [mailto:owner-
> [email protected]] De la part de Marco Petracco
> Envoyé : mercredi 13 août 2008 21:49
> À : [email protected]
> Objet : st: Syntax for options in a program
>
> Dear StataListers,
> I have been trying to crack this using the manual and online help,
> but I don't seem to be able to come out on top of it. I am writing
> a short program which should take a list of variables and give me
> back a set of Kernel graphs and also save the results in a series
> of files, the "root" of which name should be provided by the user.
> However, no matter how I specify the value of the "saving" option
> (i.e. within parentheses and braces, parentheses only, braces only
> ...) I get a "syntax error" or an "option saving() required" error
> message.
> Can anybody help me spot what I am doing wrong?
> Thanks in advance for any help.
> Regards,
> Marco
>
> I copy here under the program:
>
> program dokern, byable(recall) sortpreserve
> # delimit;
>         version 9;
>         syntax varlist [if] [in] , SAVing(string) ;
>         foreach `q' of local `_byvars' {;
>                 sort `q';
>                 marksample touse;
>                 foreach i of local `varlist' { ;
>                                 twoway (kdensity `i') if `touse',
> ylabel(, angle(horizontal) labsize(vsmall)) xlabel(0(100)1000,
> labsize(tiny)) caption("Kernel density of `i' by `touse'") saving(
> `saving'_`i'_by`touse', replace ) ;
>                                 graph export
> `saving'_`i'_by`touse'.ps, replace ;
>                 } ;
>         };
> end;
>
> Send instant messages to your online friends
> http://uk.messenger.yahoo.com
>
> *
> *   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/

*
*   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/



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