In order to perform certain operations, we may want to retrieve the list of all the names of the questions present in our data (MDD file).
We could go over that MDD file via “ IBM SPSS Data Collection Base Professional ” and list all the questions but that would be quite tedious. So we will prefer to use a script that will automatically browse our MDD and list all the names of the questions in an external text file.
To do this, simply use the following few lines of code in an MRS script (only the parameters “InputMDD” and “OutputFile” will be modified):
Dim V, Out, InputMDD, OutputFile InputMDD = "mesDonnees.mdd" OutputFile = "MyVariablesList.txt" Set Out = CreateObject("Scripting.FileSystemObject").CreateTextFile(OutputFile) With CreateObject("MDM.Document") .Open(InputMDD) For Each V In .Variables Out.WriteLine(V.Name) Next End With Out.Close()
Then we get a file “MyVariablesList.txt” which contains something in the following format:
Our next article on “IBM SPSS Data Collection” will focus on the statistical tests
and how to automatically specify the columns to test.