Thanks for the suggestion. I actually just realized
that I have the id numbers for the corrections so I
should really just be merging in the corrected data.
But, I'm always looking to learn new tricks and I
realized that I didn't give the best example. The
recode command works well for the example I gave, but
isn't as useful if you don't necessarily know the
value you're changing from. Here's another example:
. sysuse auto
. replace price=-3 if foreign==1
(22 real changes made)
Is there a way to access this 22 value? It seems
uncharacteristic of Stata to provide data in the
output that is not available as a return value.
MH
--- Richard Atkins <[email protected]> wrote:
> recode price 4999=5000
> assert `r(N)'==1
>
> Richard Atkins
> London School of Hygiene and Tropical Medicine
>
>
> >>> M Hollis <[email protected]> 30/03/2007
> 16:36 >>>
> I'm setting up a do-file to correct a number of
> errors
> in my dataset. I'd like to check that each error
> correction replaces the value in one and only one
> observation. The replace command gives output on how
> many values are replaced, but I can't seem to find
> where that value is stored, if anywhere. For
> example:
>
> sysuse auto
> replace price=5000 if price==4099
> (1 real change made)
>
> If I could access the 1 in the output, then I could
> just use something like:
> assert r(changes)==1
>
> but there doesn't seem to be a return list. I could
> do:
>
> count if price==4099
> assert r(N)==1
> replace price=5000 if price==4099
>
> I'm just wondering if there's a way to get it down
> to
> two lines.
>
> Thanks,
>
> MH
>
>
>
>
____________________________________________________________________________________
> Looking for earth-friendly autos?
> Browse Top Cars by "Green Rating" at Yahoo! Autos'
> Green Center.
> http://autos.yahoo.com/green_center/
> *
> * 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/
> *
> * 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/
>
____________________________________________________________________________________
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front
*
* 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/