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: Destringing variable
From
Richard Goldstein <[email protected]>
To
[email protected]
Subject
Re: st: Destringing variable
Date
Sat, 12 May 2012 13:10:11 -0400
there are a number of typos in your command; first, you have generated
month2 and set it to 0 for everyone; it therefor can not possibly equal
"january" regardless of case
second, after changing the variable being referred to in your "if"
statement (e.g., to month), note that strings must be (a) in
doublequotes and (b) in the same case in your command as they are in the
data
why not use the -destring- command?
Rich
On 5/12/12 1:04 PM, Shittu, Aminu wrote:
> Hi all,
>
> I am trying to destring the var name -month- using the following command but
the response was "january not found." Was it due to error in writing the
command
or because all months (JANUARY to DECEMBER) were entered in UPPERCASE
letter?
>
>
> gen month2=0
> replace month2=1 if (month2==january)
> -january not found-
>
>
> Aminu
*
* 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/