Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: macro


From   Olena Stavrunova <[email protected]>
To   [email protected]
Subject   st: macro
Date   Wed, 9 Jul 2003 06:55:02 -0500

Dear Statalist,
After running the following do-file I get the message " invalid syntax" after 
the second "while". Please, let me know what is wrong?

-------------------
clear
set memory 512m
set more off
 use "c:\data.dta"

local	k1	=	1
local	k2	=	14
local	k3	=	27
local	k4	=	40

local i=1
while `i'<=4 {
local j=1
while `j' <= `k`i'' {

replace lfsocc`j'=1 if lfsocc`j'==lfsocc`k`i'' 
replace lfsocc`j'=0 if lfsocc`j'~=1
local j=`j'+1
}
local l=`k`i''-1
egen occten`i'=rsum(lfsocc1-lfsocc`l')
keep occten*
merge using "c:\data.dta"
drop _merge
local i=`i'+1
}


-- 
Olena Stavrunova


*
*   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/



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