[email protected]
>
> I am having a problem running a do file that contains a
> while loop. Within
> the while loop, I have the following input commands:
>
> input str16 agegroup
> ""
> "age0"
> "ages1to4"
> "ages5to9"
> "ages10to14"
> "ages15to19"
> "ages20to24"
> "ages25to29"
> "ages30to34"
> "ages35to39"
> "ages40to44"
> "ages45to49"
> "ages50to54"
> "ages55to59"
> "ages60to64"
> "ages65to69"
> "ages70to74"
> "ages75to79"
> "ages80to84"
> "ages85plus"
> "total"
> end
>
> When I run the do-file I get the r(1) break message
> immediately after this
> command. However, when I remove the above command the
> do-file runs fine.
> Has anybody encountered similar problems, and is there any
> way of getting
> round this.
I've not experienced this, but I have not tried
to enter a variable in this way.
gen str1 agegroup = ""
qui replace agegroup = "age0" in 2
qui replace agegroup = "total" in 21
* fill out the ...
local args "1to4 ... 85plus"
tokenize `args'
qui forval i = 1 / 19 {
local j = `i' + 2
replace agegroup = "ages``i''" in `j'
}
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/