Select Cases

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

Select Cases

Jay Deitchman
Greetings,
 
I am using SPSS 11.5 and I am trying to select cases and running into a problem.  I would like to select cases based upon the value of one variable.  Specifically I would like to select cases that have a value of 1 or 2 or 5 or 6 for the variable called edlevel.  I am having difficulty selecting them using syntax as well as with the editor.  If anyone can provide me with the proper guidance and/or syntax for that would be great!
 
In advance, thanks!
 
Jay
 
 
p.s. - To all the dads on the Listserv, Happy Father's Day!

--
Mr. Jay B. Deitchman, M.S. Ed.
Doctoral Candidate, University at Albany
(Cell) 607.267.9447
(Home) 607.638.1909
(Office) 518.629.7567
Reply | Threaded
Open this post in threaded view
|

Re: Select Cases

Art Kendall
try this untested syntax.  You could but the ANY function as the condition for the select statement.  However, I like to keep a variable in the data that describes the subsets analyzed because inevitably there will be later drafts of the syntax,
compute keepit = any(edlevel, 1,2,5,6).
temporary.
select if keepit eq 1.


I do not recall exactly when version 11.5 was and whether the compute statement above would work.  I am fairly sure that the ANY function was available.
compute keepit = 0.
if any(edlevel, 1,2,5,6) keepit =1.
temporary.
select if keepit eq 1.


This should work with any version even back to 1972.
compute keepit = 0.
if
 edlevel eq 1 or
 edlevel eq 2 or
 edlevel eq 5 or
 edlevel eq 6  keepit = 1.
temporary.
select if keepit eq 1.


Art Kendall
Social Research Consultants

Jay Deitchman wrote:
Greetings,
 
I am using SPSS 11.5 and I am trying to select cases and running into a problem.  I would like to select cases based upon the value of one variable.  Specifically I would like to select cases that have a value of 1 or 2 or 5 or 6 for the variable called edlevel.  I am having difficulty selecting them using syntax as well as with the editor.  If anyone can provide me with the proper guidance and/or syntax for that would be great!
 
In advance, thanks!
 
Jay
 
 
p.s. - To all the dads on the Listserv, Happy Father's Day!

--
Mr. Jay B. Deitchman, M.S. Ed.
Doctoral Candidate, University at Albany
(Cell) 607.267.9447
(Home) 607.638.1909
(Office) 518.629.7567
Art Kendall
Social Research Consultants