|
Dear all,
I'm trying to figure out how to use an IF ANY statement with more than 1 variable AND more than 1 value: IF ANY (DUM1,DUM2,DUM3,1, 0) OCC_1=1. EXE. This should render OCC_1 is 1 if either DUM1, DUM2 or DUM3 is either 1 or 0. The syntax runs without errors or warnings but OCC_1 is not at all what I expected. Does anyone understand what I'm doing wrong? TIA Ruben v.d. Berg Amsterdam, the Netherlands What can you do with the new Windows Live? Find out |
|
Open a new instance of SPSS. Copy the syntax below to a syntax file. Click <run>. Click <all>. data list list/id (f2) dum1 dum2 dum3 (3f1). begin data 1 0 0 0 2 1 1 1 3 3 3 3 4 1 0 0 5 0 1 0 6 0 0 1 end data. numeric occ_1 (f1). compute occ_1 = 0. IF ANY (0, DUM1,DUM2,DUM3) or ANY (1, DUM1,DUM2,DUM3) OCC_1=1. *another way to do the syntax. numeric occ_2 (f1). compute occ_2 = ANY (0, DUM1,DUM2,DUM3) or ANY (1, DUM1,DUM2,DUM3). list. Art Kendall Social Research Consultants Ruben van den Berg wrote: Dear all,
Art Kendall
Social Research Consultants |
|
In reply to this post by Ruben Geert van den Berg
Ruben van den Berg wrote:
> I'm trying to figure out how to use an IF ANY statement with more than > 1 variable AND more than 1 value: > > IF ANY (DUM1,DUM2,DUM3,1, 0) OCC_1=1. > EXE. > > This should render OCC_1 is 1 if either DUM1, DUM2 or DUM3 is either 1 > or 0. The syntax runs without errors or > warnings but OCC_1 is not at all what I expected. Does > anyone understand what I'm doing wrong? > > > <http://www.microsoft.com/windows/windowslive/default.aspx> one variable, or more than one value, but not both. Your statement should be (notice also that I have reversed the order): IF (ANY(1,DUM1,DUM2,DUM3) OR (ANY(0,DUM1,DUM2,DUM3) OCC_1=1. HTH, Marta GarcĂa-Granero -- For miscellaneous statistical stuff, visit: http://gjyp.nl/marta/ ===================== 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 |
|
In reply to this post by Ruben Geert van den Berg
Make the first argument the value being
checked: IF ANY (0,DUM1,DUM2,DUM3) OR (1, DUM1,DUM2,DUM3) OCC_1=1. From: SPSSX(r)
Discussion [mailto:[hidden email]] On
Behalf Of Ruben van den Berg Dear all, What can you do with the new Windows Live? Find
out |
|
In reply to this post by Ruben Geert van den Berg
Ruben .... Try this ...
COMPUTE OCC_1 = RANGE(DUM1 TO DUM3, 0,
1).
EXE.
(Make sure DUM1, DUM2, and DUM3 are next to each other
with no intervening variables).
Art
------------------------------------------------------------------ Art Burke Phone: 503-275-9592 /
800-547-6339 Fax: 503-275-0450 ____________________________________________________________ I'm trying to figure out how to use an IF ANY statement with more than 1 variable AND more than 1 value: IF ANY (DUM1,DUM2,DUM3,1, 0) OCC_1=1. EXE. This should render OCC_1 is 1 if either DUM1, DUM2 or DUM3 is either 1 or 0. The syntax runs without errors or warnings but OCC_1 is not at all what I expected. Does anyone understand what I'm doing wrong? TIA Ruben v.d. Berg Amsterdam, the Netherlands What can you do with the new Windows Live? Find out |
| Free forum by Nabble | Edit this page |
