I want to find the number of values with missing or incomplete dates for each variable, so that I can create a frequency table or bar graph.
My first thought was to create a new var whose value is equal to the number of missing values with egen
Code:
egen datebcdxmis = count(datebcdx) if datebcdx == "" | length(datebcdx) < 6 | (length(datebcdx) <= 7 & substr(datebcdx,-5,1) == "/" & substr(datebcdx,-3,1) != "/")
I tried inverting the command above to count the number of non-missing/incomplete dates:
Code:
egen vmis = count(datebcdx) if !(datebcdx == "" | length(datebcdx) < 6 | (length(datebcdx) <= 7 & substr(datebcdx,-5,1) == "/" & substr(datebcdx,-3,1) != "/"))
What's the simplest way to approach this?
Once I figure it out, I'll need to put it in a loop.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str10(datebcdx datecnsdx) str8 datelmddx "08/2007" "1/29/08" "" " 9/28/2008" "" "" " 7/4/2009" "6/30/09" "6/30/09" "2006" "9/1/09" "9/1/09" " 10/3/2009" "10/3/09" "10/3/09" " 8/14/2006" "9/2/2006" "" " 8/30/2006" "8/31/10" "" " 3/12/2011" "3/12/11" "" " 3/30/2011" "3-30-11" "3-30-11" "07/2009" "" "" end
0 Response to Counting frequency of specific and missing strings
Post a Comment