Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Recode slow


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: Recode slow
Date   Fri, 28 Oct 2005 09:18:37 -0400

Just be sure to use the code 5 or 6 more times in the future and you are all set.

--NW



At 09:14 AM 10/28/2005, you wrote:

Brendan Halpin wrote:

> Is it normal that recode should be very slow with large numbers of
> "rules"? I find a recode statement with >400 value assignments adds
> something of the order of a minute to a job.
>
> N is moderately large (75k) but I wonder if recode is linear in N
> but non-linear in the number of rules or assignments.
>
> If so, any tips for efficiency? Break up the command into several
> smaller recodes? Ship out the equivalences to a lookup table and
> merge?

Just to follow myself up: I succumbed to that temptation described
by Douglas Adams as spending half a day coding something to save
thirty seconds, and switched the big recode to a lookup table.

In running time, the merge lookup (along with necessary sorts etc)
takes under 4 seconds (c 150k cases, >400 categories reassigned).
The recode version takes over 3 minutes to do the same.

So in fact I spent about half an hour to save about 2m55!

Brendan
--
Brendan Halpin,  Department of Sociology,  University of Limerick,  Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
mailto:[email protected]  http://www.ul.ie/sociology/brendan.halpin.html
*
*   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/
________________________________________________________
Nicholas J. G. Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
Cornell University falcon.arts.cornell.edu/nw53 w
308 White Hall
Ithaca, NY 14853-4601

*
* 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/




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