Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[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–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index