Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: RE: Stata analog to Mata's -strdup()- or better approach?


From   Rebecca Pope <[email protected]>
To   [email protected]
Subject   Re: st: RE: Stata analog to Mata's -strdup()- or better approach?
Date   Fri, 11 Mar 2011 17:18:16 -0600

Nick and Brendan -- Thank you for your help.

Brendan -- I should have specified that I've got about 6 million
observations. With 180 "c" variables, I don't have enough memory to
perform the -reshape-.

Nick -- Your solution produces the same result as my original program
but takes up less real estate in the do file & runs faster, so clearly
an improvement. However, it still relies on -strpos()- and thus only
finds the first instance of the set of Xs.

The only solution I could think of, and maybe I'm just being obtuse
(late Friday here, so certainly a possibility), was to use something
like -strpos(substr(estring,`i',180),X) - and loop until I'd found all
of the locations for X. However, given the number of observations, I'm
concerned about how time-intensive this will be. I can obviously keep
just the observations with multiple eligibility periods of the same
length and merge back later. If you have any further suggestions, I'd
really appreciate hearing them.

p.s. Sorry for debasing your function by calling it an option. :)

Rebecca




On Fri, Mar 11, 2011 at 3:20 PM, Nick Cox <[email protected]> wrote:
> should be
>
>  replace longest = `i' if strpos(estring, X)
>
> as there is absolutely no need to evaluate -length(X)- (repeatedly)
> when it is in fact known.
>
< truncated >

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index