Statalist


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

st: implementing a pattern to match numbers with ranges


From   - <[email protected]>
To   [email protected]
Subject   st: implementing a pattern to match numbers with ranges
Date   Sat, 13 Sep 2008 17:43:33 +0200

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/




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