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]
st: RE: Problem identifying a specific value of a string variable
From 
 
"Martin Weiss" <[email protected]> 
To 
 
<[email protected]> 
Subject 
 
st: RE: Problem identifying a specific value of a string variable 
Date 
 
Fri, 10 Sep 2010 01:22:11 +0200 
<>
Try http://www.stata.com/statalist/archive/2005-04/msg00890.html
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Brad Humphreys
Sent: Donnerstag, 9. September 2010 23:19
To: [email protected]
Subject: st: Problem identifying a specific value of a string variable
Dear Statalisters,
I have a string variable that I cannot seem to get Stata to perform
operations on.  This is part of a multiple step string to numeric
conversion. The string variable is col1_d
. desc col1_d
              storage  display     value
variable name   type   format      label      variable label
----------------------------------------------------------------------------
---------------
col1_d          str5   %9s
. tab col1_d
     col1_d |      Freq.     Percent        Cum.
------------+-----------------------------------
         2e |          1        0.00       29.09
The variable takes many values.  I have not reported the rest, as I
want to keep them. I can't get that observation, or about 10 more,
identified, using -list-, -drop-, or -replace-.  I tried:
. l if col1_d=="2e"
Returns nothing.  I tried:
. drop if col1_d=="2e"
(0 observations deleted)
I tried -trim-, -ltrim-, strltrim- on the variable, thinking there
could be leading blanks in there.  No luck.  I tried copying the
offending value for col1_d from the data editor into the do file
command.  No luck.  The variable col1_d is created using this command
gen col1_d=col1 if frac_col1==0
where col1 is a string variable.
. desc col1
              storage  display     value
variable name   type   format      label      variable label
----------------------------------------------------------------------------
---------------
col1            str10  %10s
Any help would be appreciated.   I am at wits end.
Brad Humphreys
*
*   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/
*
*   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/