Hello, I am appending 78 dta files using a loop. When I do this, some observations of the district variable appear as missing values. These values are not missing in the original dataset being appended, I checked this for these very observations. Additionally, when I look at other observations from the same dataset being appended, the district variable is not missing for all them but only for some specific values. There is nothing different about these observations aside from this issue of missing district. The district variable is a string variables in all 78 datasets with varying length.
What could be the reason behind this random missing-ness? A sample of the data and my code are given below.
Data:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str31 block str64 city str30 district
"LOHANDIGUDA" "Badangi" "Bastar"
"PITHORA" "Sukhipali" "Mahasamund"
"BAGBAHRA" "Bhalesar" "Mahasamund"
"CHHUIKHADAAN" "Dhaba" "Rajnandgaon"
"Dongargaon" "Kokpur" "Rajnandgaon"
end
Code:
Code:
local workdir "X:/Dropbox/Working Directory"
cd "`workdir'"
local files: dir "`workdir'" files "*.dta"
foreach file of local files {
append using "`file'"
}
0 Response to Missing values after appending in loop
Post a Comment