Statalist


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

Re: st: Syntax for options in a program


From   "Stas Kolenikov" <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Syntax for options in a program
Date   Wed, 13 Aug 2008 15:08:36 -0500

Option -saving- is required the way you specified it in the syntax
command. If it were [saving(string)] then it would be optional. As for
the "invalid syntax" message, it could come up from almost anywhere --
specify -set trace on; set tracedepth 2;- to see where exactly.

On 8/13/08, Marco Petracco <mpguk@yahoo.co.uk> wrote:
> 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/
>


-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index