I am using Stata v15 and would like to have an xline on the first non-missing occurrence of a variable. In this case, I would want the line to be on 08aug2019 since this is the first instance where contribution is non-missing.
Below is example of dataset
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float date int value float contribution 21762 5 . 21763 13 . 21764 20 . 21765 26 . 21766 35 . 21767 43 . 21768 55 . 21769 68 35000 21770 83 . 21771 102 . 21772 124 . 21773 148 . 21774 177 . 21775 209 . 21776 225 122000 21777 225 . 21778 225 . 21779 225 . 21780 225 . 21781 225 . 21782 225 . 21783 225 . 21784 225 . 21785 225 . 21786 225 . 21787 226 . 21788 227 . 21789 228 . 21790 229 . 21791 230 . 21792 231 . end format %td date
Code:
line value date, legend(size(medsmall)) /// xlabel(, format(%tdmd) labsize(small))
0 Response to xline based on a condition
Post a Comment