Created
December 13, 2017 13:55
-
-
Save acarril/00c89acb9a2e0d137178ac3918cb8ff9 to your computer and use it in GitHub Desktop.
Plot stacked missing and non-missing values over time (or some other discrete variable)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Plot stacked missing and non-missing values over time (or some other discrete variable) | |
// Syntax: plotmissing var timevar | |
program define plotmissing | |
tempvar has hasnt | |
gen `has' = (!mi(`1')) | |
gen `hasnt' = (mi(`1')) | |
graph hbar (sum) `has' `hasnt', /// | |
over(`2', label(labsize(vsmall))) /// | |
stack legend(order(1 "Non-missing" 2 "Missing")) /// | |
subtitle(Relative frequency of non-missing '`1'') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment