I am trying to create a code that performs forecast Analysis for multiple datasets. I am using expert modeler for the process.
After the forecasted values have been saved in spss file, I am exporting the data to an Excel file. I only want to export the predicted values along with LCL and UCL and not the original dataset.
To be able to do this, I am subsetting my dataset. The question is, is their a way to extract variables without explicitly writing the entire variable Name? For example, in place of writing
SAVE TRANSLATE = "Predicted.sav"
/KEEP Predicted_var1_Model_1 TO UCL_var10_Model_10
I wish to write a more generic code which could be applicable to any dataset irrespective of the variable Name, like
SAVE TRANSLATE = "Predicted.sav" /KEEP Predicted_*_Model_1 TO UCL_*_*
so that starting from first predicted model to the end all the variables are extracted. The reason for doing so is that different datasets may have different number and names of the variables.
The end-user of this code is someone else and I want minimal data entry in the code mainly only the source file's Location and name.
One way to do it is by using SPSSINC SELECT VARIABLES
with patterns in the variable names:
SPSSINC SELECT VARIABLES MACRONAME="!mylist"
/PROPERTIES PATTERN = "(Predicted|UCL)" .
This command will make a list of all the variables that have names starting with "Predicted" or "UCL". You can add more such patterns separated with "|".
after creating the list you can use
/keep = !mylist .