syntax help

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

syntax help

Lindsay Dewa

Hi,

 

I am new to the mailing list so I hope you can help me.

 

I am trying to calculate the Pittsburgh Sleep Quality Index sleep duration using syntax in SPSS.

 

This syntax doesn't seem to be working. Can anyone help me?

 

IF (PSQI4 GE7) PSQI4DURAT= 0.
EXECUTE.
IF (PSQI4 LT7 & PSQI4 GE6) PSQI4DURAT= 1.
EXECUTE.
IF (PSQI4 LT6 & PSQI4 GE5) PSQI4DURAT= 2.
EXECUTE.
IF (PSQI4 LT5) PSQI4DURAT= 3.
EXECUTE.

 

This is the original instructions for this component:

 

PSQIDURAT                 DURATION OF SLEEP

                                    IF Q4 > 7, THEN set value to 0

                                    IF Q4 < 7 and > 6, THEN set value to 1

                                    IF Q4 < 6 and > 5, THEN set value to 2

                                    IF Q4 < 5, THEN set value to 3

Minimum Score = 0 (better); Maximum Score = 3 (worse)

 

I'm probably over looking something!

Many thanks,

Lindsay

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: syntax help

Marta Garcia-Granero
Hi Lindsay:

There is a blank missing between GE and 7, LT and 7, and so on. Besides, only the last EXECUTE (or none) is necessary.

IF (PSQI4 GE 7) PSQI4DURAT= 0.
IF (PSQI4 LT 7 & PSQI4 GE 6) PSQI4DURAT= 1.
IF (PSQI4 LT 6 & PSQI4 GE 5) PSQI4DURAT= 2.
IF (PSQI4 LT 5) PSQI4DURAT= 3.
EXECUTE.

This should work.

HTH,
Marta GG

El 28/04/2015 a las 15:32, Lindsay Dewa escribió:

Hi,

 

I am new to the mailing list so I hope you can help me.

 

I am trying to calculate the Pittsburgh Sleep Quality Index sleep duration using syntax in SPSS.

 

This syntax doesn't seem to be working. Can anyone help me?

 

IF (PSQI4 GE7) PSQI4DURAT= 0.
EXECUTE.
IF (PSQI4 LT7 & PSQI4 GE6) PSQI4DURAT= 1.
EXECUTE.
IF (PSQI4 LT6 & PSQI4 GE5) PSQI4DURAT= 2.
EXECUTE.
IF (PSQI4 LT5) PSQI4DURAT= 3.
EXECUTE.

 

This is the original instructions for this component:

 

PSQIDURAT                 DURATION OF SLEEP

                                    IF Q4 > 7, THEN set value to 0

                                    IF Q4 < 7 and > 6, THEN set value to 1

                                    IF Q4 < 6 and > 5, THEN set value to 2

                                    IF Q4 < 5, THEN set value to 3

Minimum Score = 0 (better); Maximum Score = 3 (worse)

 

I'm probably over looking something!

Many thanks,

Lindsay

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: syntax help

David Marso
Administrator
In reply to this post by Lindsay Dewa
Please see the RECODE command.

DATA LIST FREE / Var .
BEGIN DATA
1 2 2.5 3 4 5 5.5 6 7
END DATA.
/* NOT what you want */.
RECODE Var (LO THRU 5=3)(5 THRU 6=2)(6 THRU 7=1)(7 THRU HI=0) INTO recVar1.
/* NOR */.
RECODE Var (LO THRU 4.9999=3)(5 THRU 5.99999=2)(6 THRU 6.9999=1)(7 THRU HI=0) INTO recVar1.

/* What you DO want */.
RECODE Var (7 THRU HI=0)(6 THRU 7=1)(5 THRU 6=2)(LO THRU 5=3) INTO recVar2.
LIST.
 

Lindsay Dewa wrote
Hi,



I am new to the mailing list so I hope you can help me.



I am trying to calculate the Pittsburgh Sleep Quality Index sleep duration using syntax in SPSS.



This syntax doesn't seem to be working. Can anyone help me?



IF (PSQI4 GE7) PSQI4DURAT= 0.
EXECUTE.
IF (PSQI4 LT7 & PSQI4 GE6) PSQI4DURAT= 1.
EXECUTE.
IF (PSQI4 LT6 & PSQI4 GE5) PSQI4DURAT= 2.
EXECUTE.
IF (PSQI4 LT5) PSQI4DURAT= 3.
EXECUTE.



This is the original instructions for this component:



PSQIDURAT                 DURATION OF SLEEP

                                    IF Q4 > 7, THEN set value to 0

                                    IF Q4 < 7 and > 6, THEN set value to 1

                                    IF Q4 < 6 and > 5, THEN set value to 2

                                    IF Q4 < 5, THEN set value to 3
Minimum Score = 0 (better); Maximum Score = 3 (worse)



I'm probably over looking something!

Many thanks,

Lindsay

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: syntax help

Zdaniuk, Bozena-3
In reply to this post by Lindsay Dewa

Try this one:

IF (PSQI4 LT5) PSQI4DURAT= 3.
IF (PSQI4 GE5) PSQI4DURAT= 2.
IF (PSQI4 GE6) PSQI4DURAT= 1.

IF (PSQI4 GE7) PSQI4DURAT= 0.
EXECUTE.

Bozena

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Lindsay Dewa
Sent: April 28, 2015 6:33 AM
To: [hidden email]
Subject: syntax help

 

Hi,

 

I am new to the mailing list so I hope you can help me.

 

I am trying to calculate the Pittsburgh Sleep Quality Index sleep duration using syntax in SPSS.

 

This syntax doesn't seem to be working. Can anyone help me?

 

IF (PSQI4 GE7) PSQI4DURAT= 0.
EXECUTE.
IF (PSQI4 LT7 & PSQI4 GE6) PSQI4DURAT= 1.
EXECUTE.
IF (PSQI4 LT6 & PSQI4 GE5) PSQI4DURAT= 2.
EXECUTE.
IF (PSQI4 LT5) PSQI4DURAT= 3.
EXECUTE.

 

This is the original instructions for this component:

 

PSQIDURAT                DURATION OF SLEEP

                                    IF Q4 > 7, THEN set value to 0

                                    IF Q4 < 7 and > 6, THEN set value to 1

                                    IF Q4 < 6 and > 5, THEN set value to 2

                                    IF Q4 < 5, THEN set value to 3

Minimum Score = 0 (better); Maximum Score = 3 (worse)

 

I'm probably over looking something!

Many thanks,

Lindsay

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: syntax help

Lindsay Dewa
Thanks everyone! I think I’m sorted it! 

Lindsay








On 28 Apr 2015, at 18:15, Zdaniuk, Bozena <[hidden email]> wrote:

Try this one:
IF (PSQI4 LT5) PSQI4DURAT= 3.
IF (PSQI4 GE5) PSQI4DURAT= 2.
IF (PSQI4 GE6) PSQI4DURAT= 1.
IF (PSQI4 GE7) PSQI4DURAT= 0.
EXECUTE.
Bozena
 
 
From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Lindsay Dewa
Sent: April 28, 2015 6:33 AM
To: [hidden email]
Subject: syntax help
 
Hi,
 
I am new to the mailing list so I hope you can help me.
 
I am trying to calculate the Pittsburgh Sleep Quality Index sleep duration using syntax in SPSS.
 
This syntax doesn't seem to be working. Can anyone help me?
 
IF (PSQI4 GE7) PSQI4DURAT= 0.
EXECUTE.
IF (PSQI4 LT7 & PSQI4 GE6) PSQI4DURAT= 1.
EXECUTE.
IF (PSQI4 LT6 & PSQI4 GE5) PSQI4DURAT= 2.
EXECUTE.
IF (PSQI4 LT5) PSQI4DURAT= 3.
EXECUTE.
 
This is the original instructions for this component:
 
PSQIDURAT                DURATION OF SLEEP
                                    IF Q4 > 7, THEN set value to 0
                                    IF Q4 < 7 and > 6, THEN set value to 1
                                    IF Q4 < 6 and > 5, THEN set value to 2
                                    IF Q4 < 5, THEN set value to 3
Minimum Score = 0 (better); Maximum Score = 3 (worse)
 
I'm probably over looking something!
Many thanks,
Lindsay
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to[hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: syntax help

Bruce Weaver
Administrator
In reply to this post by David Marso
From the FM entry for RECODE:

Operations
- Value specifications are scanned left to right.
- A value is recoded only once per RECODE command.
- Invalid specifications on a RECODE command that result in errors stop all processing of that RECODE
command. No variables are recoded.

In the context of David's final RECODE command...

RECODE Var (7 THRU HI=0)(6 THRU 7=1)(5 THRU 6=2)(LO THRU 5=3) INTO recVar2.

...the first two bullet points above translate as follows:

* 7 can only be recoded to 0
* 6 can only be recoded to 1
* 5 can only be recoded to 2

Finally, notice that the following will produce the same result as David's final RECODE:

RECODE Var
 (7 THRU HI=0)
 (6 THRU HI=1)
 (5 THRU HI=2)
 (LO THRU HI=3) INTO recVar3.

;-)


David Marso wrote
Please see the RECODE command.

DATA LIST FREE / Var .
BEGIN DATA
1 2 2.5 3 4 5 5.5 6 7
END DATA.
/* NOT what you want */.
RECODE Var (LO THRU 5=3)(5 THRU 6=2)(6 THRU 7=1)(7 THRU HI=0) INTO recVar1.
/* NOR */.
RECODE Var (LO THRU 4.9999=3)(5 THRU 5.99999=2)(6 THRU 6.9999=1)(7 THRU HI=0) INTO recVar1.

/* What you DO want */.
RECODE Var (7 THRU HI=0)(6 THRU 7=1)(5 THRU 6=2)(LO THRU 5=3) INTO recVar2.
LIST.
 

Lindsay Dewa wrote
Hi,



I am new to the mailing list so I hope you can help me.



I am trying to calculate the Pittsburgh Sleep Quality Index sleep duration using syntax in SPSS.



This syntax doesn't seem to be working. Can anyone help me?



IF (PSQI4 GE7) PSQI4DURAT= 0.
EXECUTE.
IF (PSQI4 LT7 & PSQI4 GE6) PSQI4DURAT= 1.
EXECUTE.
IF (PSQI4 LT6 & PSQI4 GE5) PSQI4DURAT= 2.
EXECUTE.
IF (PSQI4 LT5) PSQI4DURAT= 3.
EXECUTE.



This is the original instructions for this component:



PSQIDURAT                 DURATION OF SLEEP

                                    IF Q4 > 7, THEN set value to 0

                                    IF Q4 < 7 and > 6, THEN set value to 1

                                    IF Q4 < 6 and > 5, THEN set value to 2

                                    IF Q4 < 5, THEN set value to 3
Minimum Score = 0 (better); Maximum Score = 3 (worse)



I'm probably over looking something!

Many thanks,

Lindsay

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: syntax help

freddiefok
In reply to this post by Lindsay Dewa
Hello,

Do you by any chance have the SPSS syntax for all the components of the
PSQI?

Thanks.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: syntax help

Bruce Weaver
Administrator
The original poster (Lindsay Dewa) would likely be the only one who would
have that syntax, and there's no guarantee she's still following this
discussion forum 5 years later.  But the scoring instructions can be found
at the bottom of page 2 here:

  https://consultgeri.org/try-this/general-assessment/issue-6.1.pdf

You could have a go at coding it yourself and ask for help if you get stuck.  



freddiefok wrote

> Hello,
>
> Do you by any chance have the SPSS syntax for all the components of the
> PSQI?
>
> Thanks.
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).