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/