. ssc install nmissing
*** no. of missing 快速查看遺失值的個數n
. nmissing**
** npresent 快速查看 沒有遺失值 的資訊
* npresent lists the number of present (non-missing) values in each variable in varlist (or
optionally in each observation).*
**. summarize**
* 將遺失值 摘要整理成 表格
**. misstable summarize**
** 其他顯示遺失數據的指令
. misstable nested
. misstable tree , frequency
. misstable patterns
. misstable patterns , replace clear
* 說明書:<https://www.stata.com/manuals/rmisstable.pdf>
. findit mdesc
搜尋 mdesc 套件,並進行安裝
或
. ssc install mdesc
* m: missing
* desc: describe
* mdesc指令用來顯示資料檔中missing value的數量
* 將檔案中所有的變數,有mv的全部改為-9999
* mv
* encode
**. mvencode _all, mv(-9999)**
* tabulate var 查看某一個變數的資料分布
**. tabulate t3pautc**
School |
autonomy for |
curriculum | Freq. Percent Cum.
---------------+-----------------------------------
**-9999 | 3 1.55 1.55**
No autonomy | 93 47.94 49.48
Mixed autonomy | 23 11.86 61.34
Autonomy | 75 38.66 100.00
---------------+-----------------------------------
Total | 194 100.00
此做法會減少樣本數!
* 產生一個變數mis,裡面是所有row橫列個案有miss值的。
**egen mis = rowmiss(_all)
* 如果是mis,就丟掉!
drop if mis**
* 删除變項A的缺失值:
* drop丟掉 if A 完全等於 . 句點(句點表示空值)
. drop if A == .
. drop if A == -9999999