Dear all, I would like to run Monte Carlo simulation in Mplus using 100 data generated from Stata. To do so, I first need one master file that lists all file names.

For instance, in .txt or .dat file (i.e. replist), file names should be listed as follows:


m1.dat
m2.dat
...
m9.dat
m10.dat
...
m100.dat


I can easily generate 100 data and convert into .dat format using the following code. Yet, I have not find a way to save 100 file names in one .txt or. dat format. Please note that I need to run my models in Mplus not in Stata, and the original data generation code is more complex.

Your advice will be greatly appreciated.




Sean





Code:
forval q = 1/100 {
clear all

global obs        = 500        
global waves     = 5           

global corrXY    = .5    
global corrXZ     = 0      
global corrYZ     = 0    

mat C =(1, $corrXY,$corrXZ \ $corrXY,1,$corrYZ \ $corrXZ,$corrYZ,1)
corr2data X Y Z, n($obs) corr(C)

save "m`q'", replace
stata2mplus using "m`q'", replace
}