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
 Stata regression output failHey Stata community,
I just ran a few regressions and was wondering why Stata isn't telling me all … Stata regression output failHey Stata community,
I just ran a few regressions and was wondering why Stata isn't telling me all …
 Chained Imputation - Auxiliary variablesHello
I'm trying to do MICE imputation in Stata.
I have 17 variables in the analysis model and I h… Chained Imputation - Auxiliary variablesHello
I'm trying to do MICE imputation in Stata.
I have 17 variables in the analysis model and I h…
 What kinds of advantages we may have for the integrated use of Stata with DBMS (such as SQL Server)?What kinds of advantages we may have for the integrated use of Stata with DBMS?
Any advantages for … What kinds of advantages we may have for the integrated use of Stata with DBMS (such as SQL Server)?What kinds of advantages we may have for the integrated use of Stata with DBMS?
Any advantages for …
 Dialog box: how to force waiting for user's input?Dear Stata list,
I have a do-file that first collects username and password via dialog box, then pr… Dialog box: how to force waiting for user's input?Dear Stata list,
I have a do-file that first collects username and password via dialog box, then pr…
 Suest CommandThe following is from Suest help file
Example 2: Do coefficients vary between groups? ("Chow test")… Suest CommandThe following is from Suest help file
Example 2: Do coefficients vary between groups? ("Chow test")…
Subscribe to:
Post Comments (Atom)
0 Response to Create 50 .dat-files from stata after imputation
Post a Comment