failure to output Syntax Commands in Output file

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

failure to output Syntax Commands in Output file

msherman

Dear list:  I am running 18.0.1 and have requested that SPSS place the command lines in the output.  I have checked the appropriate boxes in the OPTIONS section. However, the commands do not show up.  In addition I get the following message (although the regular output shows up). Expecting an existing Scalar Var. at line number 56.  Does any have idea as to why this is happening.  Thanks,

 

 

 

EDITàOPTIONS->Viewer->Display commands in log

 

                                                                                                                                                                             
Martin F. Sherman, Ph.D.

Professor of Psychology

Director of Masters Education: Thesis Track
Loyola College of Arts and Sciences

 

Reply | Threaded
Open this post in threaded view
|

Re: failure to output Syntax Commands in Output file

Luca Meyer-3
<base href="x-msg://17/">Hi Martin,

Have you tried with:

SET PRINTBACK=ON.

on top of your syntax?

Cheers,
Luca


Il giorno 09/apr/2010, alle ore 16.00, Martin Sherman ha scritto:

Dear list:  I am running 18.0.1 and have requested that SPSS place the command lines in the output.  I have checked the appropriate boxes in the OPTIONS section. However, the commands do not show up.  In addition I get the following message (although the regular output shows up). Expecting an existing Scalar Var. at line number 56.  Does any have idea as to why this is happening.  Thanks,
 
 
 
EDITàOPTIONS->Viewer->Display commands in log
 
                                                                                                                                                                             
Martin F. Sherman, Ph.D.
Professor of Psychology
Director of Masters Education: Thesis Track
Loyola College of Arts and Sciences

 

Reply | Threaded
Open this post in threaded view
|

strange problem when creating new variable

Gyorgy Bea

Dear List Members,

I am experiencing a very strange problem when creating new variables in my database.

I have a very simple if condition, and the new variable should contain code 1 in case the logical statement is true.

this is the syntax:

if q23=2 and (q24=4 or q25=5) askq215=1.
fre askq215.

And this is the output:

askq215
          Frequency    Percent    Valid Percent    Cumulative Percent
Valid      1    1    1,4    1,4    1,4
            2    6    8,3    8,3    9,7
            3    16    22,2    22,2    31,9
            4    26    36,1    36,1    68,1
            5    17    23,6    23,6    91,7
            6    6    8,3    8,3    100,0
      Total    72    100,0    100,0       


Do you have any idea why is this happening?

For information: I am using SPSS 14, and the data is coming from an online data collector.

Thank you,
Beata







Reply | Threaded
Open this post in threaded view
|

Re: strange problem when creating new variable

Antoon Smulders

Hello Gyorgy,

It seems your variable already exists and has values.

To check: do a frequencies command before the computation.

If the condition is *not* true, the original values don’t change.

Greetings

Antoon Smulders

 

Van: SPSSX(r) Discussion [mailto:[hidden email]] Namens Gyorgy Bea
Verzonden: dinsdag 13 april 2010 13:37
Aan: [hidden email]
Onderwerp: strange problem when creating new variable

 


Dear List Members,

I am experiencing a very strange problem when creating new variables in my database.

I have a very simple if condition, and the new variable should contain code 1 in case the logical statement is true.

this is the syntax:

if q23=2 and (q24=4 or q25=5) askq215=1.
fre askq215.

And this is the output:

askq215
          Frequency    Percent    Valid Percent    Cumulative Percent
Valid      1    1    1,4    1,4    1,4
            2    6    8,3    8,3    9,7
            3    16    22,2    22,2    31,9
            4    26    36,1    36,1    68,1
            5    17    23,6    23,6    91,7
            6    6    8,3    8,3    100,0
      Total    72    100,0    100,0       


Do you have any idea why is this happening?

For information: I am using SPSS 14, and the data is coming from an online data collector.

Thank you,
Beata


 


 

 

Reply | Threaded
Open this post in threaded view
|

Re: strange problem when creating new variable

Art Kendall
In reply to this post by Gyorgy Bea
try doing  frequencies before the transformation. What do you see?
You might also need to do a CROSSTAB to see what is going into the transformation.
 Also you should either 1) do a compute that will account for cases that do not meet the condition
frequencies  vars = askq215 q23 q24 q25.
compute askq215 = q23 eq 2 and (q24 eq 4 or q25 eq 5).
value labels askq215 0 'no did not meet condition' 1 'yes met condition'.
frequencies  vars = askq215.


or

frequencies  vars = askq215 q23 q24 q25.
compute askq215 =0.
if q23 eq 2 and (q24 eq 4 or q25 eq 5) askq215 =1.
frequencies  vars = askq215.

Art Kendall
Social Research Consultants

On 4/13/2010 7:36 AM, Gyorgy Bea wrote:

Dear List Members,

I am experiencing a very strange problem when creating new variables in my database.

I have a very simple if condition, and the new variable should contain code 1 in case the logical statement is true.

this is the syntax:

if q23=2 and (q24=4 or q25=5) askq215=1.
fre askq215.

And this is the output:

askq215
          Frequency    Percent    Valid Percent    Cumulative Percent
Valid      1    1    1,4    1,4    1,4
            2    6    8,3    8,3    9,7
            3    16    22,2    22,2    31,9
            4    26    36,1    36,1    68,1
            5    17    23,6    23,6    91,7
            6    6    8,3    8,3    100,0
      Total    72    100,0    100,0       


Do you have any idea why is this happening?

For information: I am using SPSS 14, and the data is coming from an online data collector.

Thank you,
Beata







===================== 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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: strange problem when creating new variable

Raynald Levesque
In reply to this post by Gyorgy Bea
Hi

My guess is that variable askq215 exists BEFORE you do the if clause.
It looks like the condition is true only in one case, this is why the
freq gives you only 1 case with askq215=1.
The other values of askq215 existed before the if test, and they were
left unchanged since the condition was not true.

Raynald Levesque
www.spsstools.net



On Tue, Apr 13, 2010 at 7:36 AM, Gyorgy Bea <[hidden email]> wrote:

>
> Dear List Members,
>
> I am experiencing a very strange problem when creating new variables in my
> database.
>
> I have a very simple if condition, and the new variable should contain code
> 1 in case the logical statement is true.
>
> this is the syntax:
>
> if q23=2 and (q24=4 or q25=5) askq215=1.
> fre askq215.
>
> And this is the output:
>
> askq215
>           Frequency    Percent    Valid Percent    Cumulative Percent
> Valid      1    1    1,4    1,4    1,4
>             2    6    8,3    8,3    9,7
>             3    16    22,2    22,2    31,9
>             4    26    36,1    36,1    68,1
>             5    17    23,6    23,6    91,7
>             6    6    8,3    8,3    100,0
>       Total    72    100,0    100,0
>
>
> Do you have any idea why is this happening?
>
> For information: I am using SPSS 14, and the data is coming from an online
> data collector.
>
> Thank you,
> Beata
>
>
>
>
> ________________________________
>
>

=====================
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: strange problem when creating new variable

Gyorgy Bea
Thank you for all your suggestions. 

As I mentioned in the subject line, this is about creating a new variable. It is 100% positive, that "askq215" does NOT exist previously, so normally I should have in the new variable only 1 where condition is true and missing where condition not true. This is why I am worried about this strange behaviour. 
As I am having this kind of problem only with the data coming from this online data collector, I was thinking, that it could be related to some kind of background information coming from that tool ? Do you have an idea what should I check, or where should I look for it? 


Thank you,
Beata Gyorgy



From: Raynald Levesque <[hidden email]>
To: [hidden email]
Sent: Tue, April 13, 2010 5:56:54 PM
Subject: Re: strange problem when creating new variable

Hi

My guess is that variable askq215 exists BEFORE you do the if clause.
It looks like the condition is true only in one case, this is why the
freq gives you only 1 case with askq215=1.
The other values of askq215 existed before the if test, and they were
left unchanged since the condition was not true.

Raynald Levesque
www.spsstools.net



On Tue, Apr 13, 2010 at 7:36 AM, Gyorgy Bea <[hidden email]> wrote:

>
> Dear List Members,
>
> I am experiencing a very strange problem when creating new variables in my
> database.
>
> I have a very simple if condition, and the new variable should contain code
> 1 in case the logical statement is true.
>
> this is the syntax:
>
> if q23=2 and (q24=4 or q25=5) askq215=1.
> fre askq215.
>
> And this is the output:
>
> askq215
>          Frequency    Percent    Valid Percent    Cumulative Percent
> Valid      1    1    1,4    1,4    1,4
>            2    6    8,3    8,3    9,7
>            3    16    22,2    22,2    31,9
>            4    26    36,1    36,1    68,1
>            5    17    23,6    23,6    91,7
>            6    6    8,3    8,3    100,0
>      Total    72    100,0    100,0
>
>
> Do you have any idea why is this happening?
>
> For information: I am using SPSS 14, and the data is coming from an online
> data collector.
>
> Thank you,
> Beata
>
>
>
>
> ________________________________
>
>

=====================
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: strange problem when creating new variable

Bruce Weaver
Administrator
Can you make the data (or a subset of it) available for other folks to play with?  


Gyorgy Bea wrote
Thank you for all your suggestions.

As I mentioned in the subject line, this is about creating a new variable. It is 100% positive, that "askq215" does NOT exist previously, so normally I should have in the new variable only 1 where condition is true and missing where condition not true. This is why I am worried about this strange behaviour.
As I am having this kind of problem only with the data coming from this online data collector, I was thinking, that it could be related to some kind of background information coming from that tool ? Do you have an idea what should I check, or where should I look for it?


Thank you,
Beata Gyorgy




________________________________
From: Raynald Levesque <rlevesque@videotron.ca>
To: SPSSX-L@LISTSERV.UGA.EDU
Sent: Tue, April 13, 2010 5:56:54 PM
Subject: Re: strange problem when creating new variable

Hi

My guess is that variable askq215 exists BEFORE you do the if clause.
It looks like the condition is true only in one case, this is why the
freq gives you only 1 case with askq215=1.
The other values of askq215 existed before the if test, and they were
left unchanged since the condition was not true.

Raynald Levesque
www.spsstools.net



On Tue, Apr 13, 2010 at 7:36 AM, Gyorgy Bea <ciao_beatag@yahoo.com> wrote:
>
> Dear List Members,
>
> I am experiencing a very strange problem when creating new variables in my
> database.
>
> I have a very simple if condition, and the new variable should contain code
> 1 in case the logical statement is true.
>
> this is the syntax:
>
> if q23=2 and (q24=4 or q25=5) askq215=1.
> fre askq215.
>
> And this is the output:
>
> askq215
>           Frequency    Percent    Valid Percent    Cumulative Percent
> Valid      1    1    1,4    1,4    1,4
>             2    6    8,3    8,3    9,7
>             3    16    22,2    22,2    31,9
>             4    26    36,1    36,1    68,1
>             5    17    23,6    23,6    91,7
>             6    6    8,3    8,3    100,0
>       Total    72    100,0    100,0
>
>
> Do you have any idea why is this happening?
>
> For information: I am using SPSS 14, and the data is coming from an online
> data collector.
>
> Thank you,
> Beata
>
>
>
>
> ________________________________
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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: strange problem when creating new variable

King Douglas
In reply to this post by Gyorgy Bea
I think Raynald is right.  Assuming you have a copy of the data file before modification, I suggest that you run "FREQ askq215" and look at the output.

King Douglas

--- On Tue, 4/13/10, Gyorgy Bea <[hidden email]> wrote:

From: Gyorgy Bea <[hidden email]>
Subject: Re: strange problem when creating new variable
To: [hidden email]
Date: Tuesday, April 13, 2010, 3:03 PM

Thank you for all your suggestions. 

As I mentioned in the subject line, this is about creating a new variable. It is 100% positive, that "askq215" does NOT exist previously, so normally I should have in the new variable only 1 where condition is true and missing where condition not true. This is why I am worried about this strange behaviour. 
As I am having this kind of problem only with the data coming from this online data collector, I was thinking, that it could be related to some kind of background information coming from that tool ? Do you have an idea what should I check, or where should I look for it? 


Thank you,
Beata Gyorgy



From: Raynald Levesque <[hidden email]>
To: [hidden email]
Sent: Tue, April 13, 2010 5:56:54 PM
Subject: Re: strange problem when creating new variable

Hi

My guess is that variable askq215 exists BEFORE you do the if clause.
It looks like the condition is true only in one case, this is why the
freq gives you only 1 case with askq215=1.
The other values of askq215 existed before the if test, and they were
left unchanged since the condition was not true.

Raynald Levesque
www.spsstools.net



On Tue, Apr 13, 2010 at 7:36 AM, Gyorgy Bea <ciao_beatag@...> wrote:

>
> Dear List Members,
>
> I am experiencing a very strange problem when creating new variables in my
> database.
>
> I have a very simple if condition, and the new variable should contain code
> 1 in case the logical statement is true.
>
> this is the syntax:
>
> if q23=2 and (q24=4 or q25=5) askq215=1.
> fre askq215.
>
> And this is the output:
>
> askq215
>          Frequency    Percent    Valid Percent    Cumulative Percent
> Valid      1    1    1,4    1,4    1,4
>            2    6    8,3    8,3    9,7
>            3    16    22,2    22,2    31,9
>            4    26    36,1    36,1    68,1
>            5    17    23,6    23,6    91,7
>            6    6    8,3    8,3    100,0
>      Total    72    100,0    100,0
>
>
> Do you have any idea why is this happening?
>
> For information: I am using SPSS 14, and the data is coming from an online
> data collector.
>
> Thank you,
> Beata
>
>
>
>
> ________________________________
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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: strange problem when creating new variable

tjohnson
RE: Re: strange problem when creating new variable

Hi Beata

I have had similar problems before.  My suspicion is that this is a bug in older versions of SPSS.

A simple workaround is to create the variable with all values set to 0 first.  If you wish, you can then recode this variable so that all values of 0 are set to system missing.  Then you can create your "yes" logic setting relevant values to 1.

So, taking your example, I would recommend the following (untested):

Frequencies askq215.
Compute askq215=0.
Recode askq215(0=Sysmis).
if q23=2 and (q24=4 or q25=5) askq215=1.
Frequencies askq215.

Your conditional If statement should now work correctly.

Best regards
Tim


-----Original Message-----
From: SPSSX(r) Discussion on behalf of King Douglas
Sent: Tue 13/04/2010 9:30 PM
To: [hidden email]
Subject:      Re: strange problem when creating new variable

I think Raynald is right.  Assuming you have a copy of the data file before modification, I suggest that you run "FREQ askq215" and look at the output.

King Douglas

--- On Tue, 4/13/10, Gyorgy Bea <[hidden email]> wrote:

From: Gyorgy Bea <[hidden email]>
Subject: Re: strange problem when creating new variable
To: [hidden email]
Date: Tuesday, April 13, 2010, 3:03 PM

Thank you for all your suggestions. 

As I mentioned in the subject line, this is about creating a new variable. It is 100% positive, that "askq215" does NOT exist previously, so normally I should have in the new variable only 1 where condition is true and missing where condition not true. This is why I am worried about this strange behaviour. As I am having this kind of problem only with the data coming from this online data collector, I was thinking, that it could be related to some kind of background information coming from that tool ? Do you have an idea what should I check, or where should I look for it? 

Thank you,Beata Gyorgy

From: Raynald Levesque <[hidden email]>
To: [hidden email]
Sent: Tue, April 13, 2010 5:56:54 PM
Subject: Re: strange problem when creating new variable


Hi

My guess is that variable askq215 exists BEFORE you do the if clause.
It looks like the condition is true only in one case, this is why the
freq gives you only 1 case with askq215=1.
The other values of askq215 existed before the if test, and they were
left unchanged since the condition was not true.

Raynald Levesque
www.spsstools.net



On Tue, Apr 13, 2010 at 7:36 AM, Gyorgy Bea <[hidden email]> wrote:
>
> Dear List Members,
>
> I am experiencing a very strange problem when creating new variables in my
> database.
>
> I have a very simple if condition, and the new variable should contain code
> 1 in case the logical statement is true.
>
> this is the syntax:
>
> if q23=2 and (q24=4 or q25=5)
 askq215=1.
> fre askq215.
>
> And this is the output:
>
> askq215
>           Frequency    Percent    Valid Percent    Cumulative Percent
> Valid      1    1    1,4    1,4    1,4
>             2    6    8,3    8,3    9,7
>             3    16    22,2    22,2    31,9
>             4    26    36,1    36,1    68,1
>             5    17    23,6    23,6    91,7
>             6    6    8,3    8,3    100,0
>     
 Total    72    100,0    100,0
>
>
> Do you have any idea why is this happening?
>
> For information: I am using SPSS 14, and the data is coming from an online
> data collector.
>
> Thank you,
> Beata
>
>
>
>
> ________________________________
>
>

=====================
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: strange problem when creating new variable

Art Kendall
If the value for askq215 is missing "because the user set it it that way", it is not missing "because the software was unable to follow your instructions (syntax)".
If a user is careful never to assign sysmis to a variable, then the occurrence of sysmis can be used to help debug syntax.  People doing a quality review of you process can use the occurrence of system missing values as a red flag to see that something needs to be explained.

The distinction between system missing and user missing is one of the unique strengths of SPSS.

Since the OP gives the impression that (s)he wants to create a "logical" or "flag" variable, zero would be a clear indication that a case did not meet the assignment criteria and would rarely be missing in that situation.

OP, did you test to find out that the variable does not in fact exist by doing a FREQUENCIES?  Perhaps you made some previous efforts to create it? Did you crosstab q23 by q24 by q25?


Art Kendall
Social Research Consultants






On 4/14/2010 2:28 AM, Johnson, Timothy wrote:
RE: Re: strange problem when creating new variable

Hi Beata

I have had similar problems before.  My suspicion is that this is a bug in older versions of SPSS.

A simple workaround is to create the variable with all values set to 0 first.  If you wish, you can then recode this variable so that all values of 0 are set to system missing.  Then you can create your "yes" logic setting relevant values to 1.

So, taking your example, I would recommend the following (untested):

Frequencies askq215.
Compute askq215=0.
Recode askq215(0=Sysmis).
if q23=2 and (q24=4 or q25=5) askq215=1.
Frequencies askq215.

Your conditional If statement should now work correctly.

Best regards
Tim


-----Original Message-----
From: SPSSX(r) Discussion on behalf of King Douglas
Sent: Tue 13/04/2010 9:30 PM
To: [hidden email]
Subject:      Re: strange problem when creating new variable

I think Raynald is right.  Assuming you have a copy of the data file before modification, I suggest that you run "FREQ askq215" and look at the output.

King Douglas

--- On Tue, 4/13/10, Gyorgy Bea [hidden email] wrote:

From: Gyorgy Bea [hidden email]
Subject: Re: strange problem when creating new variable
To: [hidden email]
Date: Tuesday, April 13, 2010, 3:03 PM

Thank you for all your suggestions. 

As I mentioned in the subject line, this is about creating a new variable. It is 100% positive, that "askq215" does NOT exist previously, so normally I should have in the new variable only 1 where condition is true and missing where condition not true. This is why I am worried about this strange behaviour. As I am having this kind of problem only with the data coming from this online data collector, I was thinking, that it could be related to some kind of background information coming from that tool ? Do you have an idea what should I check, or where should I look for it? 

Thank you,Beata Gyorgy

From: Raynald Levesque [hidden email]
To: [hidden email]
Sent: Tue, April 13, 2010 5:56:54 PM
Subject: Re: strange problem when creating new variable


Hi

My guess is that variable askq215 exists BEFORE you do the if clause.
It looks like the condition is true only in one case, this is why the
freq gives you only 1 case with askq215=1.
The other values of askq215 existed before the if test, and they were
left unchanged since the condition was not true.

Raynald Levesque
www.spsstools.net



On Tue, Apr 13, 2010 at 7:36 AM, Gyorgy Bea [hidden email] wrote:
>
> Dear List Members,
>
> I am experiencing a very strange problem when creating new variables in my
> database.
>
> I have a very simple if condition, and the new variable should contain code
> 1 in case the logical statement is true.
>
> this is the syntax:
>
> if q23=2 and (q24=4 or q25=5)
 askq215=1.
> fre askq215.
>
> And this is the output:
>
> askq215
>           Frequency    Percent    Valid Percent    Cumulative Percent
> Valid      1    1    1,4    1,4    1,4
>             2    6    8,3    8,3    9,7
>             3    16    22,2    22,2    31,9
>             4    26    36,1    36,1    68,1
>             5    17    23,6    23,6    91,7
>             6    6    8,3    8,3    100,0
>     
 Total    72    100,0    100,0
>
>
> Do you have any idea why is this happening?
>
> For information: I am using SPSS 14, and the data is coming from an online
> data collector.
>
> Thank you,
> Beata
>
>
>
>
> ________________________________
>
>

=====================
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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: strange problem when creating new variable

tjohnson
RE: Re: strange problem when creating new variable

Thanks Art, this is a very useful reply.  I must admit, now that I have thought about it, I do tend to assign the sysmis only when I am assigning a logical flag to all cases, to check that this actually happens.  For the example below, I would not tend to apply it myself, for the reasons that you state.  Best regards, Tim

 

From: Art Kendall [mailto:[hidden email]]
Sent: 14 April 2010 14:14
To: Johnson, Timothy
Cc: [hidden email]; [hidden email]
Subject: Re: [SPSSX-L] strange problem when creating new variable

 

If the value for askq215 is missing "because the user set it it that way", it is not missing "because the software was unable to follow your instructions (syntax)".
If a user is careful never to assign sysmis to a variable, then the occurrence of sysmis can be used to help debug syntax.  People doing a quality review of you process can use the occurrence of system missing values as a red flag to see that something needs to be explained.

The distinction between system missing and user missing is one of the unique strengths of SPSS.

Since the OP gives the impression that (s)he wants to create a "logical" or "flag" variable, zero would be a clear indication that a case did not meet the assignment criteria and would rarely be missing in that situation.

OP, did you test to find out that the variable does not in fact exist by doing a FREQUENCIES?  Perhaps you made some previous efforts to create it? Did you crosstab q23 by q24 by q25?


Art Kendall
Social Research Consultants






On 4/14/2010 2:28 AM, Johnson, Timothy wrote:

Hi Beata

I have had similar problems before.  My suspicion is that this is a bug in older versions of SPSS.

A simple workaround is to create the variable with all values set to 0 first.  If you wish, you can then recode this variable so that all values of 0 are set to system missing.  Then you can create your "yes" logic setting relevant values to 1.

So, taking your example, I would recommend the following (untested):

Frequencies askq215.
Compute askq215=0.
Recode askq215(0=Sysmis).
if q23=2 and (q24=4 or q25=5) askq215=1.
Frequencies askq215.

Your conditional If statement should now work correctly.

Best regards
Tim


-----Original Message-----
From: SPSSX(r) Discussion on behalf of King Douglas
Sent: Tue 13/04/2010 9:30 PM
To: [hidden email]
Subject:      Re: strange problem when creating new variable

I think Raynald is right.  Assuming you have a copy of the data file before modification, I suggest that you run "FREQ askq215" and look at the output.

King Douglas

--- On Tue, 4/13/10, Gyorgy Bea [hidden email] wrote:

From: Gyorgy Bea [hidden email]
Subject: Re: strange problem when creating new variable
To: [hidden email]
Date: Tuesday, April 13, 2010, 3:03 PM

Thank you for all your suggestions. 

As I mentioned in the subject line, this is about creating a new variable. It is 100% positive, that "askq215" does NOT exist previously, so normally I should have in the new variable only 1 where condition is true and missing where condition not true. This is why I am worried about this strange behaviour. As I am having this kind of problem only with the data coming from this online data collector, I was thinking, that it could be related to some kind of background information coming from that tool ? Do you have an idea what should I check, or where should I look for it? 

Thank you,Beata Gyorgy

From: Raynald Levesque [hidden email]
To: [hidden email]
Sent: Tue, April 13, 2010 5:56:54 PM
Subject: Re: strange problem when creating new variable


Hi

My guess is that variable askq215 exists BEFORE you do the if clause.
It looks like the condition is true only in one case, this is why the
freq gives you only 1 case with askq215=1.
The other values of askq215 existed before the if test, and they were
left unchanged since the condition was not true.

Raynald Levesque
www.spsstools.net



On Tue, Apr 13, 2010 at 7:36 AM, Gyorgy Bea [hidden email] wrote:
>
> Dear List Members,
>
> I am experiencing a very strange problem when creating new variables in my
> database.
>
> I have a very simple if condition, and the new variable should contain code
> 1 in case the logical statement is true.
>
> this is the syntax:
>
> if q23=2 and (q24=4 or q25=5)
 askq215=1.
> fre askq215.
>
> And this is the output:
>
> askq215
>           Frequency    Percent    Valid Percent    Cumulative Percent
> Valid      1    1    1,4    1,4    1,4
>             2    6    8,3    8,3    9,7
>             3    16    22,2    22,2    31,9
>             4    26    36,1    36,1    68,1
>             5    17    23,6    23,6    91,7
>             6    6    8,3    8,3    100,0
>     
 Total    72    100,0    100,0
>
>
> Do you have any idea why is this happening?
>
> For information: I am using SPSS 14, and the data is coming from an online
> data collector.
>
> Thank you,
> Beata
>
>
>
>
> ________________________________
>
>

=====================
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: strange problem when creating new variable

Gyorgy Bea
In reply to this post by Art Kendall
Unfortunatelly I can't provide on the list the database (client confidentiality), and if I reduce the database to only the mentioned variables, the problem doesn't exist any more in the newly saved database. 
Variable "askq215" does not exist previously in the exported data, this is a variable created through syntax to check the data, and every time I need to rerun this syntax, I delete first the previously created variable. 



From: Art Kendall <[hidden email]>
To: "Johnson, Timothy" <[hidden email]>
Cc: [hidden email]; [hidden email]
Sent: Wed, April 14, 2010 4:13:39 PM
Subject: Re: [SPSSX-L] strange problem when creating new variable

If the value for askq215 is missing "because the user set it it that way", it is not missing "because the software was unable to follow your instructions (syntax)".
If a user is careful never to assign sysmis to a variable, then the occurrence of sysmis can be used to help debug syntax.  People doing a quality review of you process can use the occurrence of system missing values as a red flag to see that something needs to be explained.

The distinction between system missing and user missing is one of the unique strengths of SPSS.

Since the OP gives the impression that (s)he wants to create a "logical" or "flag" variable, zero would be a clear indication that a case did not meet the assignment criteria and would rarely be missing in that situation.

OP, did you test to find out that the variable does not in fact exist by doing a FREQUENCIES?  Perhaps you made some previous efforts to create it? Did you crosstab q23 by q24 by q25?


Art Kendall
Social Research Consultants






On 4/14/2010 2:28 AM, Johnson, Timothy wrote:

Hi Beata

I have had similar problems before.  My suspicion is that this is a bug in older versions of SPSS.

A simple workaround is to create the variable with all values set to 0 first.  If you wish, you can then recode this variable so that all values of 0 are set to system missing.  Then you can create your "yes" logic setting relevant values to 1.

So, taking your example, I would recommend the following (untested):

Frequencies askq215.
Compute askq215=0.
Recode askq215(0=Sysmis).
if q23=2 and (q24=4 or q25=5) askq215=1.
Frequencies askq215.

Your conditional If statement should now work correctly.

Best regards
Tim


-----Original Message-----
From: SPSSX(r) Discussion on behalf of King Douglas
Sent: Tue 13/04/2010 9:30 PM
To: [hidden email]
Subject:      Re: strange problem when creating new variable

I think Raynald is right.  Assuming you have a copy of the data file before modification, I suggest that you run "FREQ askq215" and look at the output.

King Douglas

--- On Tue, 4/13/10, Gyorgy Bea [hidden email] wrote:

From: Gyorgy Bea [hidden email]
Subject: Re: strange problem when creating new variable
To: [hidden email]
Date: Tuesday, April 13, 2010, 3:03 PM

Thank you for all your suggestions. 

As I mentioned in the subject line, this is about creating a new variable. It is 100% positive, that "askq215" does NOT exist previously, so normally I should have in the new variable only 1 where condition is true and missing where condition not true. This is why I am worried about this strange behaviour. As I am having this kind of problem only with the data coming from this online data collector, I was thinking, that it could be related to some kind of background information coming from that tool ? Do you have an idea what should I check, or where should I look for it? 

Thank you,Beata Gyorgy

From: Raynald Levesque [hidden email]
To: [hidden email]
Sent: Tue, April 13, 2010 5:56:54 PM
Subject: Re: strange problem when creating new variable


Hi

My guess is that variable askq215 exists BEFORE you do the if clause.
It looks like the condition is true only in one case, this is why the
freq gives you only 1 case with askq215=1.
The other values of askq215 existed before the if test, and they were
left unchanged since the condition was not true.

Raynald Levesque
www.spsstools.net



On Tue, Apr 13, 2010 at 7:36 AM, Gyorgy Bea [hidden email] wrote:
>
> Dear List Members,
>
> I am experiencing a very strange problem when creating new variables in my
> database.
>
> I have a very simple if condition, and the new variable should contain code
> 1 in case the logical statement is true.
>
> this is the syntax:
>
> if q23=2 and (q24=4 or q25=5)
 askq215=1.
> fre askq215.
>
> And this is the output:
>
> askq215
>           Frequency    Percent    Valid Percent    Cumulative Percent
> Valid      1    1    1,4    1,4    1,4
>             2    6    8,3    8,3    9,7
>             3    16    22,2    22,2    31,9
>             4    26    36,1    36,1    68,1
>             5    17    23,6    23,6    91,7
>             6    6    8,3    8,3    100,0
>     
 Total    72    100,0    100,0
>
>
> Do you have any idea why is this happening?
>
> For information: I am using SPSS 14, and the data is coming from an online
> data collector.
>
> Thank you,
> Beata
>
>
>
>
> ________________________________
>
>

=====================
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: strange problem when creating new variable

Richard Ristow
In reply to this post by Gyorgy Bea
At 07:36 AM 4/13/2010, Gyorgy Bea wrote:

I have a very simple if condition, and the new variable should contain code 1 in case the logical statement is true. This is the syntax:

if q23=2 and (q24=4 or q25=5) askq215=1.
fre askq215.

And this is the output:
askq215
        Frequency Percent Valid   Cumulative
                          Percent Percent
Valid  1     1      1,4     1,4     1,4
       2     6      8,3     8,3     9,7
       3    16     22,2    22,2    31,9
       4    26     36,1    36,1    68,1
       5    17     23,6    23,6    91,7
       6     6     8,3     8,3   100,0
      Total 72    100,0   100,0

and at 03:45 PM 4/14/2010, Gyorgy Bea wrote:
Unfortunately, I can't provide on the list the database (client confidentiality),

Well, if you can't give us data that reproduces the problem, that's it, then. The best of us (and you've heard from about the best of us) can do no more than guess.

Here's one more guess. You say your syntax is

if q23=2 and (q24=4 or q25=5) askq215=1.
fre askq215.

Is that really the syntax you're running, or are those a few lines from a long syntax program? If it's the latter, in the first place why didn't you say so? And use a text editor to scan the whole program for occurences of the string "askq215".
===================== 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