Page 1 of 1

Subset of Data for Simulation

Posted: Thu Feb 25, 2016 7:15 pm
by runner21
I'm running a simulation study, and I have created my datasets in SAS. I have a total of 1,000 datasets, which I combined into one file that I imported into MLwiN. This file has a field that identifies the data set, numbered from 1 to 1,000, and my plan was to use this field to create a subset of the full data set, then run each data set individually in a loop and summarize across all 1,000 datasets.
However, I'm having trouble creating a subset. I thought that the CHOOse command would work, but I can't seem to keep all variables for each data set. Is there another way to do this, apart from importing each data set individually?

Re: Subset of Data for Simulation

Posted: Fri Feb 26, 2016 10:19 am
by ChrisCharlton
In MLwiN you can set up a zero/one indicator to exclude particular rows of data from the model. You can set this either with the EXCL command, or via the hierarchy window. I would suggest that probably the easiest way for you to switch between subsets would be to keep your data in the stacked format and then use this exclusion column to select each of your simulations. For example if your simulation indicator was called 'simulation' you would select the rows that belong to the first simulation with something like:

Code: Select all

NOTE change c100 to a free column in the dataset
CALC c100 = ('simulation' != 1)
EXCL c100
you could then fit your model and repeat this for each of your other simulations.

Re: Subset of Data for Simulation

Posted: Tue Mar 01, 2016 1:21 am
by runner21
That worked- thank you!