*SPSS syntax example by www.spss-tutorials.com.
*1. Create empty test data.
data list free/mydate.
begin data
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
end data.
*2. Create range of dates.
compute mydate = datesum(date.dmy(1,1,2016),$casenum,'days').
formats mydate(date11).
execute.
*3. Extract weekdays. Note: wkday = 1 means Sunday, not Monday.
compute myday = xdate.wkday(mydate).
execute.
*4. Valuelabel weekdays.
value labels myday 1 'Sunday' 2 'Monday' 3 'Tuesday' 4 'Wednesday' 5 'Thursday' 6 'Friday' 7 'Saturday'.