In a questionnaire I asked people for how long they ususally sleep a night. Now replys were supposed to be in a h.mm format but were accidently set to h only. This is why some participants gave their sleep duration in minutes or simply wrote "830" for 8 hours 30 minutes. Now I wanted to correct for both variations and tried this first:
RECODE Sleep (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (7=7) (8=8) (9=9) (10=10)(11=11)(12=12)(13=13)(14=14)(801 thru 899 = 8.5) (701 thru 799 = 7.5)(200 thru 600 = (Sleep/60))
INTO Sleep_rek.
RECODE Sleep_rek(LOWEST thru 4.5 = 0) (5, 6= 1) (6.5 thru 7 = 2) (7.5 thru HIGHEST=3)
INTO PSQI_K3_SleepDuration.
Execute.
Since it didn't work and I thought maybe Recode can't do that, I tried this instead:
RECODE Sleep (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (7=7) (8=8) (9=9) (10=10)(11=11)(12=12)(13=13)(14=14)(801 thru 899 = 8.5) (701 thru 799 = 7.5)
INTO Sleep_rek.
IF (Sleep = (300 thru 600) & Sleep_rek = sysmis) Sleep_rek = (Sleep/60).
RECODE Sleep_rek(LOWEST thru 4.5 = 0) (5, 6= 1) (6.5 thru 7 = 2) (7.5 thru HIGHEST=3)
INTO PSQI_K3_SleepDuration.
Execute.
However this threw an error as well:
The code is incomplete, check for missing operants, invalid operants, non-matching paranthesis or too long strings.
The PSQI_K3_SleepDuration variable in the end was computed but anyone with a 300 to 600 value is still a missing value.
Can anyone tell me how to put it so it will work?