Statalist


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

st: Syntax for options in a program


From   Marco Petracco <[email protected]>
To   [email protected]
Subject   st: Syntax for options in a program
Date   Wed, 13 Aug 2008 19:48:51 +0000 (GMT)

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/



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