Bookmark and Share

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: Filling missing rank information


From   "Trelle Sven" <[email protected]>
To   <[email protected]>
Subject   st: Filling missing rank information
Date   Mon, 25 Oct 2010 16:54:06 +0200

Dear all,
I have several datasets with two variables: rank (integer) and prop
(numeric variable). All datasets should have 8 observations in the end
and ranks should range from 2 to 9. However, some datasets have less
than 8 observations due to missing information (the number of missing
ranks is different in the different datasets, however). I want to fill
in the missing rank variable with the missing ranks (and replace the
prop variable for these ranks with 0 which obviously isn't a problem). 
I started to program a very complicated way but are currently stuck and
can imagine that there is an easy way to do it ... (I can easiliy fill
in ranks if they are missing at the extremes but if ranks are missing in
the middle?).
Does anybody have an idea?

Below is an extract of possible datasets 

Thanks for any help in advance.
Sven

ex1
rank	prop
5	0.1
6	0.5
9	0.01

=> should be
rank	prop
2	0
3	0
4	0
5	0.1
6	0.5
7	0
8	0
9	0.01

ex2
rank	prop
2	0.006
3	0.03
4	0.005

ex3
rank	prop
2	0.006
3	0.03
4	0.005
5	0.1
6	0.5
9	0.01


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index