First, just like before, create a variable to count the month - but now also a variable to count the day (in TRANSFORM>COMPUTE VARIABLE):
<MONTH VARIABLE> = XDATE.MONTH(<DATE VARIABLE>)
<DAY VARIABLE> = XDATE.MDAY(<DATE VARIABLE>)
Next, aggregate the other variables. Go to DATA>AGGREGATE, select the <MONTH VARIABLE> as Break Variable and paste all the other variables (except the ones created here and the date and shif variables) in the Summaries of Variables (and choose the function you want to use to aggregate - sum the values, take the mean.....).
Now your dataset is full of repeated values. To clean it, go to DATA>SELECT CASES>IF CONDITION IS SATISFIED and use the condition: "shift = 1 & <DAY VARIABLE> = 1" (all values are the same, this is just to remove the repeated cases). Also select the <COPY SELECTED CASES TO NEW DATASET> option and give any name to the new dataset. It will create a new, clean dataset.
After that you can delete the old variables and the ones that are useless now (like shift and the day and month variables just created).
To make it easy and faster, the following syntax does it all:
Code: Select all
DATASET COPY NewDataset.
DATASET ACTIVATE NewDataset.
SELECT IF (shift = 1 & dayvar = 1).
DELETE VARIABLES shift TO dayvar.
It will leave you with the date variables an all the aggregated varibales (and no repeated values).
If you have a lot of variables, it will be faster to use the menus in the AGGREGATE part. And remember to change the function (it's sum ehre, but I don't wich one you'll use - and you can use different functions for different variables).