Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Ommit missing observations from sum, det?

From   Benedikt Achatz <>
Subject   st: Ommit missing observations from sum, det?
Date   Mon, 9 Jul 2012 17:27:35 +0200

I am trying to seperate my data into quartiles, doing it with this code:

sum initial_length, det
gen initial_length_q=1 if initial_length <=r(p25)
replace initial_length_q=2 if initial_length >r(p25) & initial_length <= r(p50)
replace initial_length_q=3 if initial_length >r(p50) & initial_length <= r(p75)
replace initial_length_q=4 if initial_length >r(p75) & initial_length <= r(p99)
replace initial_length_q=5 if initial_length >r(p99)

The problem that reveals itself to me is that if there are missing
observations, those get put in the 99% quartile. Is there any specific
reason behind it, and does anyone know how I could work around that?
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index