Statalist


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

RE: st: RE: rowlast for string variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: rowlast for string variables
Date   Sat, 29 Aug 2009 16:05:15 +0100

Inspection of the code shows that -egen, rowlast()- is indifferent to
variable type in so far as 

1. The syntax specifies a varlist without restriction. 

2. The test for missingness uses -missing()- which applies to numeric
and string variables alike. 

-egen, rowlast()- is likely to fall over for a mix of numeric and string
variables, an unlikely but not impossible request. 

Nick 
n.j.cox@durham.ac.uk 

Andrzej Niemierko

Thank you very much Joseph! Indeed, it does work. Somehow I forgot to
include type (str) in the command line.

On 8/29/09 4:50 AM, "Joseph Coveney" <jcoveney@bigplanet.com> wrote:

> -egen . . .,  rowlast(. . .)- works with string variables for me.
What
> problem
> are you having?
> 
> Joseph Coveney
> 
> . clear *
> 
> . set obs 2
> obs was 0, now 2
> 
> . generate str a = "A"
> 
> . generate str b = "B"
> 
> . replace a = "" in 1
> (1 real change made)
> 
> . replace b = "" in 2
> (1 real change made)
> 
> . egen str rowlast_for_string = rowlast(a b)
> 
> . list, noobs
> 
>   +------------------+
>   | a   b   rowlas~g |
>   |------------------|
>   |     B          B |
>   | A              A |
>   +------------------+

> Andrzej Niemierko wrote:
> 
> Is there an equivalent of egen function "rowlast(varlist)" for string
> variables?
 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index