Statalist The Stata Listserver


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

Re: st: Question on fill in missing values


From   Tom Trikalinos <[email protected]>
To   [email protected]
Subject   Re: st: Question on fill in missing values
Date   Wed, 18 Jan 2006 18:48:26 +0200

Hi Pamela,

I don't really get what you wan't to do. It is unclear for example what you mean by "I also know how often 1 or 2 should be each given in total for each year." - I do not see any year variable.

Nevertheless, if you just want to replace your missing values with 1's and 2's randomly, with probabilities prob1 and prob2 respectively, try the following commands:

set seed 12345
gen random = uniform()
replace st = 1 if random < prob1 & st == .
replace st = 2 if st ==.
drop random

tom



On Jan 18, 2006, at 6:08 PM, Pamela Mueller wrote:


I need to fill in missing values in my dataset. For most sectors I know
how many start-ups there were for each year, but the data was not given
if the number of startups is less than 3 (hence one or two).
I know that the missing should be 1 or 2 and I know the probability for
either one. I also know how often 1 or 2 should be each given in total
for each year.
I tried recode, impute, mvencode but it did not work.

Maybe someone has a hint?
Thank you!
Pamela

sect st prob1 prob2
1 4
2 3
3 . 0.3 0.7
4 8
5 0
6 . 0.45 0.55
7 3
8 5
9 . 0.48 0.52


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Pamela Mueller

Max Planck Institute of Economics
Kahlaische Strasse 10
07745 Jena, Germany

tel +49 3641 686 723
fax +49 3641 686 710

[email protected]
www.econ.mpg.de

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/


Tom Trikalinos, MD
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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