SPSS syntax time difference

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

Lindsdewa
Posts: 1
Joined: Mon Aug 25, 2014 2:57 pm

SPSS syntax time difference

Postby Lindsdewa » Mon Aug 25, 2014 3:01 pm

Hi everyone,

Can anyone help me with how to transform this into SPSS syntax?

PSQIHSE SLEEP EFFICIENCY
Diffsec = Difference in seconds between day and time of day Q1 and day Q3
Diffhour = Absolute value of diffsec / 3600
newtib =IF diffhour > 24, then newtib = diffhour – 24
IF diffhour < 24, THEN newtib = diffhour
(NOTE, THE ABOVE JUST CALCULATES THE HOURS BETWEEN GNT (Q1) AND GMT (Q3))
tmphse = (Q4 / newtib) * 100

IF tmphse > 85, THEN set value to 0
IF tmphse < 85 and > 75, THEN set value to 1
IF tmphse < 75 and > 65, THEN set value to 2
IF tmphse < 65, THEN set value to 3
Minimum Score = 0 (better); Maximum Score = 3 (worse)


Many thanks,
Lindsay
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: SPSS syntax time difference

Postby GerineL » Mon Aug 25, 2014 4:13 pm

It may be easiest to look into the date-time wizard in spss (calculate with dates and times), and look at the syntax this produces!

Who is online

Users browsing this forum: No registered users and 1 guest

cron