Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: RE: why -recode-takes longer than -replace-

From   "Martin Weiss" <>
To   <>
Subject   st: RE: why -recode-takes longer than -replace-
Date   Sun, 27 Jun 2010 23:31:51 +0200


BTW, Amanda, you may also want to upgrade to MP 11.1, which gives you even
better timings. In my case, with 4 cores, the -replace- advantage is almost

See also the latest installment of,
pages 105/106, where -replace- profits from MP much more than -recode-. 


-----Original Message-----
[] On Behalf Of Amanda Fu
Sent: Sonntag, 27. Juni 2010 22:11
Subject: st:why -recode-takes longer than -replace-

Dear Statalisters,

I am just curious about a fact noticeable when I use -recode- (1 as
following) or -replace- (2 as following)  to recode all the variables
in a data set (size :  52,996,616) using Stata 10.1 SE: the recode
command  takes much longer than replace. I was wondering what causes
the speed difference and if the speed difference implies for large
data set it would be better to use replace instead of recode.

1.  slower
.recode _all (8=.) (9=.)

2. faster
foreach v of varlist * {
.replace `v'=. if `v'==8 | `v'==9

Thanks for your time!

*   For searches and help try:

*   For searches and help try:

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