I'm wondering if someone can help me with creating .dat-files from a stata dataset after I applied data-imputation.
I first imputed data:
mi register imputed attitude emp_scale serious_sce attrib selfeff colleg collef ///
leadership decision Harmful Powerimb Repetition Intention
mi impute mvn attitude emp_scale serious_sce attrib selfeff colleg collef ///
leadership decision Harmful Powerimb Repetition Intention = liketoint, ///
add(50) rseed (53421)
Subsequently, I saved these datafiles as .dta-files with:
preserve
forval i=1/50{
mi extract `i', clear
save mi_file`i',
restore, preserve
}
However, I would like to create the same files in .dat-file-types.. Is this possible?
I tried this:
foreach i in `_mi_m'{
use "C:\Users\Oct17.dta", clear
drop if _mi_m !=`i'
export delimited _mi_m using "C:\Users\\`i'\Oct17.dta",
replace delimiter(tab) nolabel novar
}
but it did not work, neither did this:
use "C:\Users\16oct.dta", clear
egen which = group(_mi_m), label
sum which, meanonly
forval i=1/`r(max)'{
local where : label (which) `i'
export delimited $vars if which==`i' using "C:\Users\`where'/DV/17okt.dat",
delimiter(tab) nolabel novar replace
}
I also tried to replace $vars with "_mi_m", but that did not work either. I do not understand how to export these 50 datafiles and create .dat-files at the same time, is this even possible? Thank you in advance for any help!
Related Posts with Create 50 .dat-files from stata after imputation
xtgraphI am trying to use -xtgraph- to plot cross-sectional mean and sd of a variable in a panel dataset. H…
Cpoisson LSDVMy outcome is counts left-censored at y<1000. I have panel data and want to run a model with fixe…
Combining groups of percentiles in collapseHi guys, I'm trying to collapse a large dataset by year, gender, and economic sector but instead of…
Generate a new binary variable from different variables in a datasetHello everyone, I have a dataset with many “employment status” variables, such as full-time job is c…
ebmeans with imputed data?Is there a way to calculate ebmeans with mi data? Trying to get a "mean" of a latent variable that I…
Subscribe to:
Post Comments (Atom)
0 Response to Create 50 .dat-files from stata after imputation
Post a Comment