Statalist


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

Re: st: Loop over variables with svyset


From   "Daniel Schultz" <[email protected]>
To   [email protected]
Subject   Re: st: Loop over variables with svyset
Date   Wed, 19 Nov 2008 17:57:08 +0000

Ok thanks for all the comments...
with the -capture block the do-file is running,
BUT
is actually producing no output after the first error.
This is the part of my do-file (to make it more quick only until Number 3)

capture {
forvalues k=1/3{
if `k' < 100 local k 0`k'
if `k' < 10 local k 0`k'
 forvalues year=2/7 {
 svyset [pw=Q1170_0`year']
 svy: tab Q0`k'_0`year'
mat Q0`k'_0`year' = (e(Prop)\e(total))
}
}
}

The first error occurs after the first run of the second forvalues
(forvalues year=2/7 {) loop (number 3).
With the capture block, the do-file is working, but the mat command
only produces a matrix until the first error (a matrix only for year
=2). Thus, I assume, that it is not working totally.

With adding -noisily the do file stops when the first error occurs.
Best
Daniel


2008/11/19 Buzz Burhans <[email protected]>:
> server
>
> Steve wrote
> "Just be aware that  captured statements, whether they produce errors
> or not,  show no output."
>
>
> -capture noisily {
> ...
> }-
>
> will produce output if the command does not fail and would otherwise produce
> output.
>
> So capture, with noisily added, should give you output, unless the command
> fails
>
> Buzz Burhans
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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