Hi there,
I am trying to replicate a loop that runs well and fast in SAS, but is very
slow in STATA on my machine.
Perhaps someone will spot some awkward piece of code in the following?
many thanks for your attention,
[email protected]
*** STATA PROGRAM
set memory 700m ** couldn't do better than 700M
version 10
use r2f3_glm.dta, clear
local i 94
while `i' ~= 103 {
xi: logit yr00 i.age i.educ i.educ*age i.educ*age2 i.educ*age3 i.educ*age4
[pweight=ihwt] if year~=`i'
predict pyr00 if e(sample), p
gen rw00=ihwt*pyr00/(1-pyr00)
sum yr00 pyr00 rw00 if year~=100
drop pyr00 rw00
local i = `i'+ 1
}
exit
*** SAS PROGRAM
proc logistic data=one(where=(year ne 100)) descending;
class yr00 educ agedum;
model yr00=agedum educ educ*age educ*age2 educ*age3 educ*age4;
weight ihwt;
output out=temp1 predicted=pyr00;
run;
data temp1;
set temp1;
rw00=ihwt*pyr00/(1-pyr00);
*
* 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/