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

st: Capture inside a forvalues loop

From   Conor Sontag <>
Subject   st: Capture inside a forvalues loop
Date   Thu, 24 Sep 2009 13:25:44 -0400

I have an error inside of my for values loop which is inconsequential
to my results, but i would like to log it in another variable so I can
later look at the data set and see where the error occured.  What I
have now is:

quietly sum duplicate
forvalues j = 1/`r(max)' {
capture replace advisor = advisorindividual`j' if duplicate == `j'

I have tried a couple of different ways, but I'm not sure how I can
create a variable "error" which will displays zeros in each row where
the error did not occur, and display the error _rc in the rows that it
did occur.

*   For searches and help try:

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