From timestamps ("YYYY-MM-DD") in the data set, new variables can also be built in the codebook using SQL, e.g. days of the week and parts of the day:
SQL formulas for days:
Monday | {{=SUM(WEEKDAY(date)=0)}} |
Tuesday | {{=SUM(WEEKDAY(date)=1)}} |
Wednesday | {{=SUM(WEEKDAY(date)=2)}} |
Thursday | {{=SUM(WEEKDAY(date)=3)}} |
Freiday | {{=SUM(WEEKDAY(date)=4)}} |
Saturday | {{=SUM(WEEKDAY(date)=5)}} |
Sunday | {{=SUM(WEEKDAY(date)=6)}} |
SQL formulas for parts of the day (example):
06:00 - 09:00 a.m. | {{=SUM(HOUR(date)=6 OR HOUR(date)=7 OR HOUR(date)=8)}} |
09:00 - 12:00 a.m. | {{=SUM(HOUR(date)=9 OR HOUR(date)=10 OR HOUR(date)=11)}} |
12:00 - 17:00 p.m | {{=SUM(HOUR(date)=12 OR HOUR(date)=13 OR HOUR(date)=14 OR HOUR(date)=15 OR HOUR(date)=16)}} |
17:00 - 21:00 p.m | {{=SUM(HOUR(date)=17 OR HOUR(date)=18 OR HOUR(date)=19 OR HOUR(date)=20)}} |
21:00 - 24:00 p.m | {{=SUM(HOUR(date)=21 OR HOUR(date)=22 OR HOUR(date)=23)}} |
24:00 - 06:00 a.m. | {{=SUM(HOUR(date)=0 OR HOUR(date)=1 OR HOUR(date)=2 OR HOUR(date)=3 OR HOUR(date)=4 OR HOUR(date)=5)}} |
(replace date with name of timestamp variable)
With the {{= ... }} formulas the frequency is counted. But the same formulas can also be written with {{ ... }} to be used as a filter.
Kommentare
0 Kommentare
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.