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: encode command and then drop
From
Julian Kochan <[email protected]>
To
[email protected]
Subject
st: encode command and then drop
Date
Sun, 23 Mar 2014 21:18:07 +0100
Hi Statalisters,
i am new to Stata and try to recode strings into numeric Numbers.
I have data of 10.000 firms for the years 2000-2011 such that the first colum displays the firm Key and the second displays the years.
I wanted to drop certain firms. But the command * drop if Key == C0056 led to "type mismatch".
I though it's probably due to Key coded as string and not as a number.
Now, I want to recode the firm names into numbers.
I tried
encode Key, generate (Key2).
I know it is encoded now, but in the data editor it still displays the keys in the variable "Key2" and not the numbers from 1 till 10.000.
I want to encode in such a way, that I can drop in the following step all firms using the drop if Key== (for example) 2 3 10 65 or 98
Thank you guys
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/