I have a large dataset I have to aggregate using numerous functions (e.g. max, min, mean, etc.).
All variables have similar prefixes. I can call these dynamically using spssinc select variables and then aggregate using the code below.
spssinc select variables macroname="!vars_prefix" /properties pattern="prefix*.".
DATASET DECLARE Test.
SORT CASES BY ID_No.
AGGREGATE
/OUTFILE='Test'
/PRESORTED
/BREAK=ID_No
/!vars_prefix=MEAN(!vars_prefix).
I am unsure how to do this for multiple functions and apply the function name as a suffix in the aggregated output. I imagined something like below would have worked (but alas it didn't). Is this possible or a limitation of SPSS Statistics?
DATASET DECLARE Test.
SORT CASES BY ID_No.
AGGREGATE
/OUTFILE='Test'
/PRESORTED
/BREAK=ID_No
/CONCAT(!vars_prefix, '_Mean')=MEAN(!vars_prefix)
/CONCAT(!vars_prefix, '_Max')=MAX(!vars_prefix).