Statalist


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

Re: st: implementing a pattern to match numbers with ranges


From   Martin Weiss <martin.weiss@uni-tuebingen.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: implementing a pattern to match numbers with ranges
Date   Sat, 13 Sep 2008 18:00:12 +0200

So matching means -generate-ing a new var based on the values of "SIC"? If so then

g industry=03 if SIC>=100 & SIC <799
replace industry=03 if SIC == 2048

and so forth for the other intervals...

HTH
Martin


Quoting - <mc_allister@gmx.de>:


Dear all,

I have many numbers with 4 digits, like 0100, 2044,... (this variable
is called "SIC"). Now I want to match this number to a two-digit number
(this new variable is called "Industry").

The matching should be like this:

       0100-0799,2048-2048=03
       2000-2046,2050-2063,2070-2079,2090-2095,2098-2099=23
       2064-2068,2086-2087,2096-2097=47
       2080-2085='08'

One example: variable "SIC" is given with the value 0100. Then Stata
should give variable "Industry" the value 03 for this row.

I am looking for a way to implement this pattern. I hope there is
someone with an idea...

Thanks a lot,
Silke R.
*
*   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