LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2007)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 7 May 2007 01:03:51 -0700
Reply-To:     eblange <elke.lange@helsinki.fi>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         eblange <elke.lange@helsinki.fi>
Subject:      Re: SPSS 15 syntax IF command bug?
In-Reply-To:  <463E1B28.5060308@verizon.net>
Content-Type: text/plain; charset=us-ascii

Below is what I get with my syntax. One problems seems to be the missing values. When I define the variables first (compute to_pos1=-1) as Art suggests, then do the shovelling, and then set the minus 1 to missing, it works. The results of Art are exactly what I want. Still, this sensitivity of SPSS to missing values is new to me, so it might be good to spread this information around a bit. Thanks to all, Elke

gettingA gettingA gettingA gettingB gettingB gettingB 1 2 3 1 2 3 want1 want2 want3

. 0 . 0 0 0 . 0 . 1 . . 1 1 1 1 . . 0 . . 0 0 0 0 . . 1 . . 1 0 0 1 . . 1 1 1 1 1 1 . . 1 0 0 0 0 0 0 . . 0 . 1 . 1 1 1 . 1 . . 1 . 0 1 0 . 1 . 0 0 0 0 0 0 . . 0 1 1 1 1 1 1 . . 1 . 0 . 0 0 0 . 0 . 1 . . 1 1 1 1 . . 1 1 1 1 1 1 . . 1 . 1 . 0 1 0 . 1 . 1 . . 1 1 1 1 . . 1 1 1 1 1 1 . . 1 . 1 . 1 1 1 . 1 . 1 . . 1 1 1 1 . . . 0 . 1 0 1 . 0 . 1 1 1 1 1 1 . . 1

Number of cases read: 20 Number of cases listed: 20

Art Kendall-2 wrote: > > In version 15 I used this syntax and got the tables below the syntax. > They show 6, 7, and 7 valid values for To_pos1 to to_pos3 corresponding > to the number of cases with 1,2 an3 for tarpos. > > If this still shows the problem you are describing please add 6 more > variables to the example data. > > getting1 to getting3 to show what you are getting on your system. > want1 to want3 to show what you want in to_pos1 to to_pos3. > > You can get what I am asking for by manually adding want1 to want3, > doing a LIST, cut-and-paste to an email > and then editing the names of to_pos variables > > data list list/vpnr (f1) trial(f2) > cvc11 cvc12 cvc13 > cvc21 cvc22 cvc23 > cvc31 cvc32 cvc33 > tarpos ovlappos (11f1). > begin data > 1 1 1 1 1 0 0 0 0 1 1 2 1 > 1 2 1 1 1 1 1 1 1 1 1 1 2 > 1 3 0 0 0 0 0 0 0 1 1 1 1 > 1 4 1 1 1 1 1 1 1 1 0 1 3 > 1 5 1 1 1 1 0 1 1 1 1 3 3 > 1 6 0 0 0 0 0 1 0 0 0 3 1 > 1 7 1 1 1 1 1 1 1 1 1 2 3 > 1 8 1 1 1 0 1 0 0 0 0 2 2 > 1 9 0 0 0 0 0 0 0 0 0 3 2 > 1 10 0 0 0 1 1 1 1 1 1 3 2 > 1 11 0 0 0 1 1 0 1 1 0 2 3 > 1 12 1 1 1 1 1 1 1 1 1 1 1 > 1 13 1 1 1 1 1 1 1 1 1 3 3 > 1 14 1 1 0 1 1 1 0 1 0 2 1 > 1 15 0 1 1 0 0 0 1 1 1 1 2 > 1 16 1 1 1 1 1 1 1 1 1 3 1 > 1 17 0 0 0 1 1 0 0 1 0 2 2 > 1 18 1 1 1 1 1 1 1 1 1 1 3 > 1 19 0 1 1 0 1 1 1 1 1 2 1 > 1 20 1 1 1 1 1 1 1 1 1 3 1 > end data. > *intialize result variables so we can see what falls through the "sieve". > * and to avoid the use of system missing. > numeric to_pos1 to to_pos3 (f1). > compute to_pos1 = -1. > compute to_pos2 = -1. > compute to_pos3 = -1. > * begin original transformations. > if (tarpos eq 1 and ovlappos eq 1) to_pos1=cvc11. > if (tarpos eq 1 and ovlappos eq 2) to_pos1=cvc12. > if (tarpos eq 1 and ovlappos eq 3) to_pos1=cvc13. > > if (tarpos eq 2 and ovlappos eq 1) to_pos2=cvc21. > if (tarpos eq 2 and ovlappos eq 2) to_pos2=cvc22. > if (tarpos eq 2 and ovlappos eq 3) to_pos2=cvc23. > > if (tarpos eq 3 and ovlappos eq 1) to_pos3=cvc31. > if (tarpos eq 3 and ovlappos eq 2) to_pos3=cvc32. > if (tarpos eq 3 and ovlappos eq 3) to_pos3=cvc33. > * end original transformations. > frequencies vars = to_pos1 to to_pos3. > crosstabs > /variables = tarpos ovlappos (1,3) to_pos1 to to_pos3 (-1,1) > /tables= tarpos by ovlappos > /to_pos1 to to_pos3 by tarpos by ovlappos > /missing=report. > * to_pos1* > > Frequency Percent Valid Percent Cumulative Percent > Valid -1 14 70.0 70.0 70.0 > 0 1 5.0 5.0 75.0 > 1 5 25.0 25.0 100.0 > Total 20 100.0 100.0 > > > * to_pos2* > > Frequency Percent Valid Percent Cumulative Percent > Valid -1 13 65.0 65.0 65.0 > 0 3 15.0 15.0 80.0 > 1 4 20.0 20.0 100.0 > Total 20 100.0 100.0 > > > * to_pos3* > > Frequency Percent Valid Percent Cumulative Percent > Valid -1 13 65.0 65.0 65.0 > 0 2 10.0 10.0 75.0 > 1 5 25.0 25.0 100.0 > Total 20 100.0 100.0 > > > * tarpos * ovlappos Crosstabulation* > Count > > ovlappos Total > 1 2 3 1 > tarpos 1 2 2 2 6 > 2 3 2 2 7 > 3 3 2 2 7 > Total 8 6 6 20 > > > * to_pos1 * tarpos * ovlappos Crosstabulation* > Count ovlappos > > tarpos Total > 1 2 3 1 > 1 to_pos1 -1 0 3 3 6 > 0 1 0 0 1 > 1 1 0 0 1 > Total 2 3 3 8 > 2 to_pos1 -1 0 2 2 4 > 0 0 0 0 0 > 1 2 0 0 2 > Total 2 2 2 6 > 3 to_pos1 -1 0 2 2 4 > 0 0 0 0 0 > 1 2 0 0 2 > Total 2 2 2 6 > > > * to_pos2 * tarpos * ovlappos Crosstabulation* > Count ovlappos > > tarpos Total > 1 2 3 1 > 1 to_pos2 -1 2 0 3 5 > 0 0 2 0 2 > 1 0 1 0 1 > Total 2 3 3 8 > 2 to_pos2 -1 2 0 2 4 > 0 0 0 0 0 > 1 0 2 0 2 > Total 2 2 2 6 > 3 to_pos2 -1 2 0 2 4 > 0 0 1 0 1 > 1 0 1 0 1 > Total 2 2 2 6 > > > * to_pos3 * tarpos * ovlappos Crosstabulation* > Count ovlappos > > tarpos Total > 1 2 3 1 > 1 to_pos3 -1 2 3 0 5 > 0 0 0 1 1 > 1 0 0 2 2 > Total 2 3 3 8 > 2 to_pos3 -1 2 2 0 4 > 0 0 0 1 1 > 1 0 0 1 1 > Total 2 2 2 6 > 3 to_pos3 -1 2 2 0 4 > 0 0 0 0 0 > 1 0 0 2 2 > Total 2 2 2 6 > > > Art Kendall > Social Research Consultants > > eblange wrote: >> Dear Richard, >> >> thanks you for your reply. I decided that the problem has maybe to do >> with a >> bug on the installation CD. It is replicable on other PCs with the same >> version, and also with different ways to write IF commands (e.g., DO >> IF... >> ELSE IF). But nevertheless, if you would like to take a look at it would >> be >> nice. >> >> input data (excerpt): >> >> vpnr trial cvc11 cvc12 cvc13 cvc21 cvc22 cvc23 cvc31 >> cvc32 cvc33 tarpos >> ovlappos >> 1 1 1 1 1 0 0 0 0 1 >> 1 2 1 >> 1 2 1 1 1 1 1 1 1 1 >> 1 1 2 >> 1 3 0 0 0 0 0 0 0 1 >> 1 1 1 >> 1 4 1 1 1 1 1 1 1 1 >> 0 1 3 >> 1 5 1 1 1 1 0 1 1 1 >> 1 3 3 >> 1 6 0 0 0 0 0 1 0 0 >> 0 3 1 >> 1 7 1 1 1 1 1 1 1 1 >> 1 2 3 >> 1 8 1 1 1 0 1 0 0 0 >> 0 2 2 >> 1 9 0 0 0 0 0 0 0 0 >> 0 3 2 >> 1 10 0 0 0 1 1 1 1 1 >> 1 3 2 >> 1 11 0 0 0 1 1 0 1 1 >> 0 2 3 >> 1 12 1 1 1 1 1 1 1 1 >> 1 1 1 >> 1 13 1 1 1 1 1 1 1 1 >> 1 3 3 >> 1 14 1 1 0 1 1 1 0 1 >> 0 2 1 >> 1 15 0 1 1 0 0 0 1 1 >> 1 1 2 >> 1 16 1 1 1 1 1 1 1 1 >> 1 3 1 >> 1 17 0 0 0 1 1 0 0 1 >> 0 2 2 >> 1 18 1 1 1 1 1 1 1 1 >> 1 1 3 >> 1 19 0 1 1 0 1 1 1 1 >> 1 2 1 >> 1 20 1 1 1 1 1 1 1 1 >> 1 3 1 >> >> >> output: The syntax should create 3 more variables (to_pos1 ..t_pos3) that >> show either a missing value (for two of them) or a rewritten value from >> the >> input CVC11 to CVC33. What I get is >> a) sometimes all three variables get an input value, sometimes all three >> the >> same, sometimes different. >> b) sometimes the value has no obvious relation to the input (e.g. 0.5 >> istead >> of 1 or 0) >> c) sometimes everything looks alright, that is in maybe 1 out of 10 >> cases. >> >> warning messages? Not at all! >> >> Cheers, >> Elke >> >> >> -- >> View this message in context: >> http://www.nabble.com/SPSS-15-syntax-IF-command-bug--tf3685036.html#a10345245 >> Sent from the SPSSX Discussion mailing list archive at Nabble.com. >> >> >> > >

-- View this message in context: http://www.nabble.com/SPSS-15-syntax-IF-command-bug--tf3685036.html#a10353564 Sent from the SPSSX Discussion mailing list archive at Nabble.com.


Back to: Top of message | Previous page | Main SPSSX-L page