Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: finding a sequence of numbers within a numeric variable


From   Michael McCulloch <mm@pinest.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: finding a sequence of numbers within a numeric variable
Date   Sun, 31 Aug 2008 12:34:56 -0700

Thanks Friedrich, works very well! Yes, the data were in numeric format.


Michael,

I assume the variable is in numeric format.

. list

     +-------+
     |   var |
     |-------|
  1. |  8070 |
  2. | 80703 |
  3. |  8071 |
     +-------+

. list if substr(string(var),1,4)=="8070"

     +-------+
     |   var |
     |-------|
  1. |  8070 |
  2. | 80703 |
     +-------+

Friedrich

On Sat, Aug 30, 2008 at 2:26 PM, Michael McCulloch <mm@pinest.org> wrote:
 Hello,
 If I have a variable that contains:
        8070
        80703
        8071
 is it possible to define an -if- statement that will give me
        8070
        80703
 but not
        8071
 ?
*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index