newbie: syntax help (maybe lag function?)

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

newbie: syntax help (maybe lag function?)

annastella
Hi everyone,

I would really appreciate it if someone could give me some guidance:

I am working on a data file that contains two lines for each individual, one weekend diary and one weekend diary for each. I have created a dichotomous variable (weekday active 0/1) from the first line of each person, namely the weekeday diary. I now want to analyze the other line of all individuals (the weekend diary) that are weekday active = 1 (in their other line).

Is there a way that I can do that with an spss command to filter out people that are weekday active = 0 in the one line to be able to analyze only the ones that are 1?

Many thanks in advance, Anna
Reply | Threaded
Open this post in threaded view
|

Re: newbie: syntax help (maybe lag function?)

John F Hall
Not quite clear what your data look like, but have you tried:
 
select if     weekday = 0.
 
..then do the analysis.  If you want to keep all the data intact, you need to write:
 
temporary.
select if     weekday = 0.
 
...otherwise you'll lose all the other cases in the file.
 
Sorry, but I only use syntax.  To do this in Mickey-Mouse use:
 

File

…New

            …Syntax

 

<IMG height=245 src="file://C:\DOCUME~1\Owner\LOCALS~1\Temp\msohtml1\01\clip_image002.jpg" width=625 v:shapes="_x0000_i1025">

 

write the commands in the box (including full stops) and then run.

 
----- Original Message -----
Sent: Sunday, August 30, 2009 11:49 AM
Subject: newbie: syntax help (maybe lag function?)


Hi everyone,

I would really appreciate it if someone could give me some guidance:

I am working on a data file that contains two lines for each individual, one
weekend diary and one weekend diary for each. I have created a dichotomous
variable (weekday active 0/1) from the first line of each person, namely the
weekeday diary. I now want to analyze the other line of all individuals (the
weekend diary) that are weekday active = 1 (in their other line).

Is there a way that I can do that with an spss command to filter out people
that are weekday active = 0 in the one line to be able to analyze only the
ones that are 1?

Many thanks in advance, Anna
--
View this message in context: http://www.nabble.com/newbie%3A-syntax-help-%28maybe-lag-function-%29-tp25208480p25208480.html
Sent from the SPSSX Discussion mailing list archive at 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: newbie: syntax help (maybe lag function?)

John F Hall
In reply to this post by annastella
Anna
 
Not sure you needed  do if
 
What's wrong with...
 
if ((freetime > 8.9) & (weekend = 1)) timepoor=0.
if ((freetime < 9) & (weekend = 1)) timepoor=1.
 
If you want me to have a look at your SPSS *.sav file and your questionnaire/schedule or whatever instrument you've used, send me an attachment and I'll have a look at it.
 
Meanwhile check out the  absolute beginner stuff under Teaching Documents on my webpage
 
 
Years ago (1972-ish) I used to joke about writing The Clods' Guide to Survey Analysis (using SPSS).  In 2009 I'm well on the way!
 
Meanwhile, back to some more tutorials for the site.
 
John


 
----- Original Message -----
Sent: Sunday, August 30, 2009 4:58 PM
Subject: Re: newbie: syntax help (maybe lag function?)

How about?
 
 
your do if bits....
 
select if timepoor = 1 and weekend =1.
----- Original Message -----
Sent: Sunday, August 30, 2009 4:12 PM
Subject: Re: newbie: syntax help (maybe lag function?)


Thank you John,

I am afraid it is not that simple -at least for me. The thing is I created the variable by a do if command


do if freetime > 8.9 & weekend = 1 .
compute timepoor=0.
end if.

do if freetime < 9 & weekend = 1.
compute timepoor=1.
end if.
execute.

So the variable timepoor refers to the people that let's say do not have enough free time during the weekday (which is 1). What I am trying to do now is use this variable for the other line of each individual in my file (weekend = 2). So I basically want to analyze the weekends of people that are timepoor (=1) when weekend = 1. I hope this is a bit clearer and makes sense. I thought of the lag function but being a newbie it's not terribly clear what I could do.

Regards

Anna




John F Hall-2 wrote:

>
> Not quite clear what your data look like, but have you tried:
>
> select if     weekday = 0.
>
> ..then do the analysis.  If you want to keep all the data intact, you need
> to write:

> temporary.
> select if     weekday = 0.
>
> ...otherwise you'll lose all the other cases in the file.
>
> Sorry, but I only use syntax.  To do this in Mickey-Mouse use:
>
> File
>
> .New
>
>             .Syntax
>

>
>
>
>
>
> write the commands in the box (including full stops) and then run.
>
>
>   ----- Original Message -----
>   From: annastella
>   To: [hidden email]
>   Sent: Sunday, August 30, 2009 11:49 AM
>   Subject: newbie: syntax help (maybe lag function?)
>
>
>
>   Hi everyone,
>
>   I would really appreciate it if someone could give me some guidance:
>
>   I am working on a data file that contains two lines for each individual,
> one
>   weekend diary and one weekend diary for each. I have created a
> dichotomous
>   variable (weekday active 0/1) from the first line of each person, namely
> the
>   weekeday diary. I now want to analyze the other line of all individuals
> (the
>   weekend diary) that are weekday active = 1 (in their other line).
>
>   Is there a way that I can do that with an spss command to filter out
> people
>   that are weekday active = 0 in the one line to be able to analyze only
> the
>   ones that are 1?
>
>   Many thanks in advance, Anna
>   --
>   View this message in context:
> http://www.nabble.com/newbie%3A-syntax-help-%28maybe-lag-function-%29-tp25208480p25208480.html
>   Sent from the SPSSX Discussion mailing list archive at 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
>
>
>
Quoted from:
http://www.nabble.com/newbie%3A-syntax-help-%28maybe-lag-function-%29-tp25208480p25211796.html


Reply | Threaded
Open this post in threaded view
|

Re: newbie: syntax help (maybe lag function?)

Bruce Weaver
Administrator
In reply to this post by annastella
annastella wrote
Hi everyone,

I would really appreciate it if someone could give me some guidance:

I am working on a data file that contains two lines for each individual, one weekend diary and one weekend diary for each. I have created a dichotomous variable (weekday active 0/1) from the first line of each person, namely the weekeday diary. I now want to analyze the other line of all individuals (the weekend diary) that are weekday active = 1 (in their other line).

Is there a way that I can do that with an spss command to filter out people that are weekday active = 0 in the one line to be able to analyze only the ones that are 1?

Many thanks in advance, Anna
Try this:

use all.
compute weekend = NOT weekday.
format weekend(f1.0).
filter by weekend.
exe.

* Analyses of weekend data here .

filter off. /* use all records again.

Note that the line "compute weekend = NOT weekday" could have been written as: "compute weekend = (weekday EQ 0)".  But in SPSS, variables that have only 1 and 0 as values (like your WEEKDAY) can be treated the same way as boolean variables in other programming languages,with 1=True, and 0=False.  This allows you to write somewhat more readable code like "compute weekend = NOT weekday".
--
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/).