Re: Selecting cases with Odd ID-# -thanks

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

Re: Selecting cases with Odd ID-# -thanks

Samar Samy
Excuse me, I need help for data analysis using SPSS. I am working on large
data set and want to know how can I select cases based on the odd or even
value of a certain variable, NOT BASED ON THE VALUE OF ID. For example, the
number of visits, if it is even or odd

=====================
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: Selecting cases with Odd ID-# -thanks

kwame woei
Select if (any(Char.rindex(variable, 1, 1), '0', '2, '4', '6', '8').
Execute.



Op 19 mrt. 2014 om 21:46 heeft "Samar Samy" <[hidden email]> het volgende geschreven:

> Excuse me, I need help for data analysis using SPSS. I am working on large
> data set and want to know how can I select cases based on the odd or even
> value of a certain variable, NOT BASED ON THE VALUE OF ID. For example, the
> number of visits, if it is even or odd
>
> =====================
> 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: Selecting cases with Odd ID-# -thanks

David Marso
Administrator
In reply to this post by Samar Samy
See MOD function .

Samar Samy wrote
Excuse me, I need help for data analysis using SPSS. I am working on large
data set and want to know how can I select cases based on the odd or even
value of a certain variable, NOT BASED ON THE VALUE OF ID. For example, the
number of visits, if it is even or odd

=====================
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: Selecting cases with Odd ID-# -thanks

David Marso
Administrator
In reply to this post by kwame woei
You are making the assumption that the variable is string.
OP did not state that this is the case.
You would also merely be selecting cases where a string variable BEGINS with an EVEN number.
Should read the question before trying to answer it?

kwame woei wrote
Select if (any(Char.rindex(variable, 1, 1), '0', '2, '4', '6', '8').
Execute.



Op 19 mrt. 2014 om 21:46 heeft "Samar Samy" <[hidden email]> het volgende geschreven:

> Excuse me, I need help for data analysis using SPSS. I am working on large
> data set and want to know how can I select cases based on the odd or even
> value of a certain variable, NOT BASED ON THE VALUE OF ID. For example, the
> number of visits, if it is even or odd
>
> =====================
> 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
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: Selecting cases with Odd ID-# -thanks

Rick Oliver-3
In reply to this post by David Marso
Yes.
compute newvar=mod(visits, 2).

If newvar=0, it's even.
If newvar=1, it's odd.

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        David Marso <[hidden email]>
To:        [hidden email],
Date:        03/19/2014 04:30 PM
Subject:        Re: Selecting cases with Odd ID-# -thanks
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




See MOD function .


Samar Samy wrote
> Excuse me, I need help for data analysis using SPSS. I am working on large
> data set and want to know how can I select cases based on the odd or even
> value of a certain variable, NOT BASED ON THE VALUE OF ID. For example,
> the
> number of visits, if it is even or odd
>
> =====================
> 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





-----
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?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Re-Selecting-cases-with-Odd-ID-thanks-tp5724928p5724930.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: Selecting cases with Odd ID-# -thanks

Bruce Weaver
Administrator
In reply to this post by Samar Samy
David has already suggested using the MOD function.  While he was posting that, I was working on a small example that uses MOD.  If I don't now post it, I'll feel like I wasted my time--so here it is!

NEW FILE.
DATASET CLOSE all.

* Change path to indicate where you store the SPSS sample data files on your PC.
GET FILE = "C:\SPSSdata\survey_sample.sav".

FREQUENCIES marital.

COMPUTE MSodd = MOD(marital,2).
COMPUTE MSeven = NOT MSodd.
FORMATS MSodd MSeven(f1).

* Check that it worked.
CROSSTABS marital by MSodd MSeven.


Samar Samy wrote
Excuse me, I need help for data analysis using SPSS. I am working on large
data set and want to know how can I select cases based on the odd or even
value of a certain variable, NOT BASED ON THE VALUE OF ID. For example, the
number of visits, if it is even or odd

=====================
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: Selecting cases with Odd ID-# -thanks

kwame woei
In reply to this post by David Marso
I thought of stating the necessity of converting numeric to string, but I thought it obvious.

Regarding the selection of even numbers you're right, but it's the last number of the string, not the first, so OP is selecting even numbers.



Op 19 mrt. 2014 om 22:33 heeft "David Marso" <[hidden email]> het volgende geschreven:

> You are making the assumption that the variable is string.
> OP did not state that this is the case.
> You would also merely be selecting cases where a string variable BEGINS with
> an EVEN number.
> Should read the question before trying to answer it?
>
>
> kwame woei wrote
>> Select if (any(Char.rindex(variable, 1, 1), '0', '2, '4', '6', '8').
>> Execute.
>>
>>
>>
>> Op 19 mrt. 2014 om 21:46 heeft "Samar Samy" &lt;
>
>> samarabdelhafeez.epid@
>
>> &gt; het volgende geschreven:
>>
>>> Excuse me, I need help for data analysis using SPSS. I am working on
>>> large
>>> data set and want to know how can I select cases based on the odd or even
>>> value of a certain variable, NOT BASED ON THE VALUE OF ID. For example,
>>> the
>>> number of visits, if it is even or odd
>>>
>>> =====================
>>> 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
>>
>> =====================
>> 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
>
>
>
>
>
> -----
> 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?"
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Re-Selecting-cases-with-Odd-ID-thanks-tp5724928p5724931.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

=====================
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