How to select cases based on id variable so only those that have values are included?

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

How to select cases based on id variable so only those that have values are included?

Sammm313
Hi

So I have a database with about 500 variables including an ID variable that
is continous. I want to create a new database of only those cases that have
a values for each of those 500 variables so that I can see for which of the
people I have all the values for and if they match up and are the same
person as the measurement were supposed to have been taken at the same time
so ideally the same person will have a value for variable A as for B to Z.
If that makes sense?



--
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: How to select cases based on id variable so only those that have values are included?

David Marso
Administrator
If all variables are numeric then it is three lines. If there are string
variables it becomes more complicated.

DO IF (NMISS(ALL) EQ 0).
XSAVE OUTFILE= fill in a valid filespec.
END IF.
EXECUTE.
GET FILE fill in a valid filespec.



Sammm313 wrote

> Hi
>
> So I have a database with about 500 variables including an ID variable
> that
> is continous. I want to create a new database of only those cases that
> have
> a values for each of those 500 variables so that I can see for which of
> the
> people I have all the values for and if they match up and are the same
> person as the measurement were supposed to have been taken at the same
> time
> so ideally the same person will have a value for variable A as for B to Z.
> If that makes sense?
>
>
>
> --
> 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

 



-----
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?"
--
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
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: How to select cases based on id variable so only those that have values are included?

David Marso
Administrator
Something like this?

DATA LIST FREE / n1 (F1) s1 (A1) n2 (F1) s2 (A1) n3 (F1) s3 (A1).
BEGIN DATA
1 s 2 x 3 y
. '' 2 x 3 a
END DATA.

SPSSINC SELECT VARIABLES MACRONAME="!Strings" VARIABLES=n1 s1 n2 s2 n3
s3/PROPERTIES TYPE=STRING.
SPSSINC SELECT VARIABLES MACRONAME="!Numbers" VARIABLES=n1 s1 n2 s2 n3
s3/PROPERTIES TYPE=NUMERIC

COUNT Blanks=!Strings("").
DO IF SUM(NMISS(!Numbers), Blanks) EQ 0.
XSAVE OUTFILE= fill in a valid filespec.
END IF.
EXECUTE.
GET FILE fill in a valid filespec.
DELETE VARIABLES Blanks.


David Marso wrote

> If all variables are numeric then it is three lines. If there are string
> variables it becomes more complicated.
>
> DO IF (NMISS(ALL) EQ 0).
> XSAVE OUTFILE= fill in a valid filespec.
> END IF.
> EXECUTE.
> GET FILE fill in a valid filespec.
>
>
>
> Sammm313 wrote
>> Hi
>>
>> So I have a database with about 500 variables including an ID variable
>> that
>> is continous. I want to create a new database of only those cases that
>> have
>> a values for each of those 500 variables so that I can see for which of
>> the
>> people I have all the values for and if they match up and are the same
>> person as the measurement were supposed to have been taken at the same
>> time
>> so ideally the same person will have a value for variable A as for B to
>> Z.
>> If that makes sense?
>>
>>
>>
>> --
>> 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
>
>  
>
>
>
> -----
> 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?"
> --
> 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





-----
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?"
--
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
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: How to select cases based on id variable so only those that have values are included?

Jon Peck
Even easier, you can leave the 
VARIABLES= n1 s1 n2 s2 n3 s3 
off the SPSSINC SELECT VARIABLES command as it will automatically consider all variables and, in this case, select all the string or all the numeric variables.

This command appears on the menus as Utilities > Define Variable Macro.

On Fri, Jun 15, 2018 at 7:21 AM, David Marso <[hidden email]> wrote:
Something like this?

DATA LIST FREE / n1 (F1) s1 (A1) n2 (F1) s2 (A1) n3 (F1) s3 (A1).
BEGIN DATA
1 s 2 x 3 y
. '' 2 x 3 a
END DATA.

SPSSINC SELECT VARIABLES MACRONAME="!Strings" VARIABLES=n1 s1 n2 s2 n3
s3/PROPERTIES TYPE=STRING.
SPSSINC SELECT VARIABLES MACRONAME="!Numbers" VARIABLES=n1 s1 n2 s2 n3
s3/PROPERTIES TYPE=NUMERIC

COUNT Blanks=!Strings("").
DO IF SUM(NMISS(!Numbers), Blanks) EQ 0.
XSAVE OUTFILE= fill in a valid filespec.
END IF.
EXECUTE.
GET FILE fill in a valid filespec.
DELETE VARIABLES Blanks.


David Marso wrote
> If all variables are numeric then it is three lines. If there are string
> variables it becomes more complicated.
>
> DO IF (NMISS(ALL) EQ 0).
> XSAVE OUTFILE= fill in a valid filespec.
> END IF.
> EXECUTE.
> GET FILE fill in a valid filespec.
>
>
>
> Sammm313 wrote
>> Hi
>>
>> So I have a database with about 500 variables including an ID variable
>> that
>> is continous. I want to create a new database of only those cases that
>> have
>> a values for each of those 500 variables so that I can see for which of
>> the
>> people I have all the values for and if they match up and are the same
>> person as the measurement were supposed to have been taken at the same
>> time
>> so ideally the same person will have a value for variable A as for B to
>> Z.
>> If that makes sense?
>>
>>
>>
>> --
>> 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
>

>
>
>
> -----
> 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?"
> --
> 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





-----
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?"
--
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



--
Jon K Peck
[hidden email]

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