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   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: RE: Stata analog to Mata's -strdup()- or better approach?
Date   Mon, 14 Mar 2011 11:22:38 +0000

Using -split- was mentioned early in the thread.

Your trick is a nice one. Finding the longest is also possible by
using -length()- or by using the fact that "X", "XX", "XXX", etc. can
be compared using < as "X" < "XX", etc.

In this particular problem, creating lots of extra variables as might
be expected from -split- didn't sound an especially good approach to
me, especially as there are more direct ways of getting at the maximum
and the dataset was relatively large.

It's always helpful to know various ways to approach a problem.

Nick

On Mon, Mar 14, 2011 at 11:03 AM, David Elliott <[email protected]> wrote:
> Did anyone think of splitting on the -- and changing the XX... to
> 11...  One would not be counting Xs then since 11... would be a number
> that one could work on directly to determine which was the largest.
>
> I provide no code and am just suggesting this as a conceptual approach.
>
> DC Elliott
>

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