Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: r(110) error with -svy-, -mark-, -marksample-


From   <[email protected]>
To   <[email protected]>
Subject   st: r(110) error with -svy-, -mark-, -marksample-
Date   Tue, 31 Jul 2012 23:43:30 +0100

Thank you, Stas!  Your supposition explains the behaviour observed
(including why it worked ok on 12 July 2012).

There were a load of temporary variables created in the process of
making my "voldat.dta" data set. But I had simply assumed that they
would have all disappeared when the data creation do file had
successfully completed. And they it turns out that they hadn't. They
weren't in my face as "voldat.dta" is large.

The (non-elegant) code which creates the tempvars is:

quietly {
forval t = 1/18 {
 forval f = 0/1   {
	tempvar temp1
	tempvar temp2
	tempvar temp3
	tempvar temp4

	regress mwage1 A A2 A3 A4 if mwage1 > 0 & !missing(mwage1) &
wave == `t' & female == `f'
	predict double `temp1' if e(sample), residuals
	regress mwage1 A A2 A3 A4 [aw = xrwght] if mwage1 > 0 &
!missing(mwage1) & wave == `t' & female == `f'
	predict double `temp2' if e(sample), residuals
	
	regress mwage2 A A2 A3 A4 if mwage2 > 0 & !missing(mwage2) &
wave == `t' & female == `f'
	predict double `temp3' if e(sample), residuals
	regress mwage2 A A2 A3 A4 [aw = xrwght] if mwage2 > 0 &
!missing(mwage2) & wave == `t' & female == `f'
	predict double `temp4' if e(sample), residuals

	replace mwage1res_u = `temp1' if mwage1 > 0 & !missing(mwage1) &
wave == `t' & female == `f'
	replace mwage1res_w = `temp2' if mwage1 > 0 & !missing(mwage1) &
wave == `t' & female == `f'
	replace mwage2res_u = `temp3' if mwage2 > 0 & !missing(mwage2) &
wave == `t' & female == `f'
	replace mwage2res_w = `temp4' if mwage2 > 0 & !missing(mwage2) &
wave == `t' & female == `f'
 }
}
}

I've now added a -drop __*- line after this section, and the temporary
variables are no longer retained in "voldat.dta". And the job with the
call to -idonepsu- now works again.

I remain surprised that the tempvars weren't automatically deleted at
the end of the data creation job.

------------------------------------------------------------------------
--------


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index