Daniel Muller
>
> I have a (part of a) small program, where I create
> -tempvar-s. However,
> the -save- keeps these temporary variables in the saved
> file. What am I
> missing here?
>
> ---------------
> prog def spatsam
> 	version 8.0
> 	syntax , Gap(int) Xc(str) Yc(str) SAVing(str) REPLACE
> 	preserve
> 	tempvar x y
> 	gen `x'=`xc'/`gap'
> 	gen `y'=`yc'/`gap'
> 	keep if `x'==int(`x') & `y'==int(`y')
> 	save `saving', `replace'
> 	restore
> end
> ---------------
Your title should be, I guess, not dropped
before -save-.
Temporary variables persist for the lifetime
of a program or until you -drop- them.
Hence you need to -drop- before you -save-.
Alternatively, as presumably -xc- and -yc- are
really variable names
prog spatsam
 	version 8.0
 	syntax , Gap(int) Xc(varname) Yc(varname) SAVing(str) REPLACE
 	preserve
 	keep if (`xc'/`gap')==int(`xc'/`gap') &
(`yc'/`gap')==int(`yc'/`gap')
 	save `saving', `replace'
 	restore
end
Nick
[email protected]
*
*   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/