Some errors running frequencies and crosstabs

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

Some errors running frequencies and crosstabs

Tanaka Akiko
Hello, I came back to using SPSS after about 5 years of being away from it.
 At the first attempt at analysis, I've encountered some errors and have
not been able to move forward.  I wonder if any of you can help me out.

The version that I am using is SPSS 13,0 for Windows Graduate Student
Version Release 13.0 (1 Sep 2004).  I run it on my personal laptop.

The data set that I'm working on is fairly simple, with 350 cases and
currently 51 variables.  The data were entered into Excel first and then
read into SPSS.

There are several dates in the data set, the dates, months, and years
entered as separate variables and then combined into yyyy/mm/dd format.
Then some lengths of time (in number of years) were calcluated by taking
differences between these dates.

1. First problem I encounter is when I run frequencies on these number of
years variables.  In two of the three frequency outputs, I have two rows of
".00" (zero years categories).  For example:

agetodayy
                Frequency       Percent Valid Percent   Cumulative Percent
Valid   .00     2       .6      .6      .6
        .00     1       .3      .3      .9
        1.00    1       .3      .3      1.2
        2.00    32      9.1     9.2     10.4
        3.00    95      27.1    27.5    37.9
        4.00    122     34.9    35.3    73.1
        5.00    84      24.0    24.3    97.4
        6.00    8       2.3     2.3     99.7
        7.00    1       .3      .3      100.0
        Total   346     98.9    100.0
Missing System  4       1.1
Total           350     100.0

But this is not a big deal.  I can always combine the two .00 catogories.

2. Then I encounter another problem when I try to run the crosstabs of
these "years" variables with sex.
agetodayy * Sex Crosstabulation
Count
                Sex             Total
                1       2
agetodayy       .00     1       0       3
        1.00    1       0       1
        2.00    20      0       32
        3.00    44      0       94
        4.00    64      0       122
        5.00    50      0       84
        6.00    4       0       8
        7.00    0       0       1
Total           184     161     345

In the first crosstab I run, the Sex 2 category has total frequency (161),
but none of the individual cells are filled (they come out as all zeros).
Why is this and how can I fix this?

3. Then I try running frequency (number of years x sex) with another
variable, and then I get this error.
"The SPSS Processor is terminating due to a catastrophic error.  Any
workind data file is lost.  An SPSS program error has occurred:
Programmer's assertion failed.  Please note the circumstances under which
this error occurred, attempting to replicate it if possible, and then
notify SPSS Technical Support.  Restart the processor? Yes/No"

and the data set disappears (the data editor is open and the name of the
file is still on top, but the data itself has disappeared and the
spreadsheet is blank).

It still produces an output, like this.

agestartnsy * Sex Crosstabulation
Count
                Sex             Total
                1       2
agestartnsy     .00     1       0       6
        1.00    0       0       20
        2.00    0       0       139
        3.00    0       0       121
        4.00    0       0       40
        5.00    0       0       17
Total           183     160     343

Also, something that comes out in the output between the one discussed
under 2 and under 3 is:
"_ASSERT(cell .eq. ihis+1) failed in crcorr"

I tried running this whole process many times (after restarting the
computer, not running any other software currently or before SPSS, etc.)
but result is always the same.

If any of you can suggest a way to fix this problem that would be great.  I
need to present results from this data set at a conference in one month.  I
must also say I don't have the disk to reinstall the software with me (and
will not before the conference time).

Thank you!

_________________________________________________________________
 $B0lEY;H$C$?$i$d$a$i$l$J$$!*!) (BMSN $B!" (BWindows Live  $B8~$1$N:G?7%V%i%&%6$O$3$A$i (B
http://promotion.msn.co.jp/ie7/
Reply | Threaded
Open this post in threaded view
|

Re: Some errors running frequencies and crosstabs

Richard Ristow
At 02:58 AM 5/19/2007, Tanaka Akiko wrote:

>I've encountered some errors and have not been able to move
>forward.  I wonder if any of you can help me out.

At best, these answers are tentative and conjectural. I hope they may
help some.

>The version that I am using is SPSS 13,0 for Windows Graduate Student
>Version Release 13.0 (1 Sep 2004).  I run it on my personal laptop.
>
>The data set that I'm working on is fairly simple, with 350 cases and
>currently 51 variables.  The data were entered into Excel first and
>then read into SPSS.
>
>There are several dates in the data set, the dates, months, and years
>entered as separate variables and then combined into yyyy/mm/dd format.

I take it, and hope, that these are numeric SPSS date-format variables,
and that the "yyyy/mm/dd" format is the display format (SDATE10).

>Then some lengths of time (in number of years) were calcluated by
>taking differences between these dates.
>
>1. First problem I encounter is when I run frequencies on these number
>of years variables.  In two of the three frequency outputs, I have two
>rows of ".00" (zero years categories).  For example:
>
>agetodayy
>            Frequency  Percent Valid    Cumulative
>                               Percent  Percent
>Valid  .00     2       .6      .6       .6
>        .00     1       .3      .3       .9
>        1.00    1       .3      .3      1.2
[... I've reformatted]

That's a fairly common problem, due to rounding: If your calculation of
the time difference doesn't give exact integers, you can have two
values that are actually distinct, and get distinct rows in the
frequencies table, but are displayed rounded to the same value.

The question is, whether that's your problem. There are ways to
calculate a difference that are very prone to this problem, and ways
that guarantee it won't happen. You could try setting the format for
the "agetodayy" to, say, F13.10, and see whether the values appear
different at that resolution. Or, post the code you use to calculate
the differences. (Or both.0

>But this is not a big deal.  I can always combine the two .00
>catogories.

Right; understood.

>2. Then I encounter another problem when I try to run the crosstabs of
>these "years" variables with sex.
>agetodayy * Sex Crosstabulation
>Count
>                Sex          Total
>                1       2
>agetodayy
>         .00    1       0      3
>        1.00    1       0      1
>        2.00   20       0     32
>        3.00   44       0     94
>        4.00   64       0    122
>        5.00   50       0     84
>        6.00    4       0      8
>        7.00    0       0      1
>Total        184     161    345
>
>In the first crosstab I run, the Sex 2 category has total frequency
>(161), but none of the individual cells are filled (they come out as
>all zeros). Why is this and how can I fix this?

I don't recall anything like this; it seems pretty clearly wrong, but I
can't even suggest a reason. All I can say it, it looks very strange to
me, too.

>3. Then I try running frequency (number of years x sex) with another
>variable, and then I get this error.
>"The SPSS Processor is terminating due to a catastrophic error. [...]
>Programmer's assertion failed."

As it looks like to you, the SPSS processor has got itself badly
confused. (An assertion failure automatically means this.)

Things that *MAY* help are,

A. SAVE OUTFILE=<filename> after you load from Excel, then GET FILE and
run from there. That may iron out any problems where the file as
imported from Excel isn't quite valid. Probably, do this right after
you've read the Excel, before you do any calculations; do the
calculations after you load.

B. Read as tab-delimited, rather than from Excel (see "Tab-delimited
ASCII files" in the GET TRANSLATE command). To do this, from Excel,
"SAVE AS" and choose output format "Text (tab delimited)"; then, read
the resulting file, in SPSS. This will especially help, if your running
a release of Excel that's later than was available when SPSS 13 was
written. (This strategy may be the most likely to be successful.)

C. LIST the file. That will be hard to read with 51 variables, and a
little long with 350 cases, but it may let you see if any data has
loaded drastically differently from what it should be.

D. Try using AGGREGATE to compute the cell counts:

AGGREGATE OUTFILE=*
    /BREAK   =agestartnsy Sex
    /CELLSIZE 'No. in Crosstab cell' = N.
LIST.

That should give you the cell counts, not as neatly formatted as
CROSSTABS does, but using different code within SPSS. If this works and
CROSSTABS doesn't, it's a useful diagnostic, though there will won't be
an obvious interpretation. And it's possible to run your CROSSTABS from
the aggregated file, which may at least work around the problem.

E. Post all your code, starting with the GET TRANSLATE (I assume you
use this) to read the Excel file, up to the CROSSTABS where SPSS
crashes. *Maybe* there will be some quirk of code that, if changed,
might work around the problem. (I don't mean an error in your code. No
coding error, however severe, should crash SPSS like that. However, a
coding error combined with a problem in the file *might* make the code
more 'fragile'.)

Good luck, and I hope this can be worked out one way or another,
Richard
Reply | Threaded
Open this post in threaded view
|

Re: Some errors running frequencies and crosstabs

Tanaka Akiko
Hi, Richard

Thank you for all your suggestions!
I tried all of them (except LIST, but I scrolled through the data set and
examined to see if there are any weird values).  However, I still get the
same errors.

AGGREGATE worked, but I'm still not sure why I get the original error to
start with, and even though I can get away with it this time, if I don't
correct the source of the problem, I imagine running into the same kind of
trouble in future analyses.

Here is the complete syntax.  Most of them were created using Analyze menu
and copied onto the Syntax window using "Paste."

Any help to resolve this problem will be appreciated!!
Akiko

GET DATA  /TYPE = TXT
 /FILE = 'C:\Documents and Settings\Owner\My Documents\TOPS\psychosocial
checklist\Psychosocial checklist data 2006'+
 ' tablim.txt'
 /DELCASE = LINE
 /DELIMITERS = "\t "
 /ARRANGEMENT = DELIMITED
 /FIRSTCASE = 2
 /IMPORTCASE = ALL
 /VARIABLES =
 ID F2.1
 camp F1.0
 ns F1.0
 bdayd F2.1
 bdaym F2.1
 bdayy F4.2
 tdayd F2.1
 tdaym F1.0
 tdayy F4.2
 nsd F2.1
 nsm F1.0
 nsy F4.2
 Sex F1.0
 Q1 F1.0
 Q2 F1.0
 Q3 F1.0
 Q4 F1.0
 Q5 F1.0
 Q6 F1.0
 Q7 F1.0
 Q8 F1.0
 Q9 F1.0
 Q10 F1.0
 Q11 F1.0
 Q12 F1.0
 Q13 F1.0
 Q14 F1.0
 Q15 F1.0
 Q16 F1.0
 Q17 F1.0
 Q18 F1.0
 Q19 F1.0
 Q20 F1.0
 Q21 F1.0
 Q22 F1.0
 Q23 F1.0
 Q24 F1.0
 Q25 F1.0
 Q26 F1.0

 .
CACHE.
EXECUTE.



* Date and Time Wizard: birthdate.
COMPUTE birthdate = DATE.DMY(bdayd, bdaym, bdayy).
VARIABLE LABEL birthdate "birth date for the child".
VARIABLE LEVEL birthdate (SCALE).
FORMATS birthdate (SDATE10).
VARIABLE WIDTH birthdate(10).
EXECUTE.

* Date and Time Wizard: todaydate.
COMPUTE todaydate = DATE.DMY(tdayd, tdaym, tdayy).
VARIABLE LABEL todaydate "the date the form was completed".
VARIABLE LEVEL todaydate (SCALE).
FORMATS todaydate (SDATE10).
VARIABLE WIDTH todaydate(10).
EXECUTE.

* Date and Time Wizard: nsstartdate.
COMPUTE nsstartdate = DATE.DMY(nsd, nsm, nsy).
VARIABLE LABEL nsstartdate "the date the child started attending the
nursery school".
VARIABLE LEVEL nsstartdate (SCALE).
FORMATS nsstartdate (SDATE10).
VARIABLE WIDTH nsstartdate(10).
EXECUTE.

COMPUTE agestartns = DATEDIFF(nsstartdate, birthdate, "days") .
EXECUTE .

COMPUTE agetoday = DATEDIFF(todaydate, birthdate, "days") .
EXECUTE .

COMPUTE timeinns = DATEDIFF(todaydate, nsstartdate, "days") .
EXECUTE .

COMPUTE timeinnsm = DATEDIFF(todaydate, nsstartdate, "months") .
EXECUTE .

COMPUTE timeinnsy = DATEDIFF(todaydate, nsstartdate, "years") .
EXECUTE .

COMPUTE agestartnsm = DATEDIFF(nsstartdate, birthdate, "months") .
EXECUTE .

COMPUTE agestartnsy = DATEDIFF(nsstartdate, birthdate, "years") .
EXECUTE .

COMPUTE agetodaym = DATEDIFF(todaydate, birthdate, "months") .
EXECUTE .

COMPUTE agetodayy = DATEDIFF(todaydate, birthdate, "years") .
EXECUTE .

**Each of above variables (results of COMPUTE) sorted and any negative
numbers (result of inaccurate dates reported) deleted by hand**

FREQUENCIES
  VARIABLES=Sex timeinnsy agestartnsy agetodayy
  /ORDER=  ANALYSIS .

CROSSTABS
  /TABLES=agetodayy  BY Sex
  /FORMAT= AVALUE TABLES
  /STATISTIC=CHISQ
  /CELLS= COUNT
  /COUNT ROUND CELL .
CROSSTABS
  /TABLES=agestartnsy  BY Sex
  /FORMAT= AVALUE TABLES
  /STATISTIC=CHISQ
  /CELLS= COUNT
  /COUNT ROUND CELL .

**With above, it does not crash but output has a row with all zeros in
cells but the total is 161**

CROSSTABS
  /TABLES=timeinnsy  BY Sex
  /FORMAT= AVALUE TABLES
  /STATISTIC=CHISQ
  /CELLS= COUNT
  /COUNT ROUND CELL .

**CRASH!**

_________________________________________________________________
 $B:G?7%V%i%&%6$N (BMSN $BHG$,EP>l!*2wE,$JJXMx$J%M%C%H%i%$%U$NI,<{IJ$G$9 (B
http://promotion.msn.co.jp/ie7/
Reply | Threaded
Open this post in threaded view
|

Re: Some errors running frequencies and crosstabs

Richard Ristow
At 12:56 AM 5/23/2007, Tanaka Akiko wrote:

>Hi, Richard
>
>Thank you for all your suggestions! I tried all of them (except LIST,
>but I scrolled through the data set and examined to see if there are
>any weird values).  However, I still get the same errors.
>
>AGGREGATE worked, but I'm still not sure why I get the original error,
>and if I don't correct the source of the problem, I imagine running
>into the same kind of trouble in future analyses.

I regret to say that sounds only too likely. And I don't see the
problem. I could test your code, if you sent me data, but I've got SPSS
9, 14, and 15; testing with those, won't tell much about 13. And it may
well not be SPSS 13 as such; as you thought, your particular
installation may have gone bad in some way.

>Here is the complete syntax.  Most of them were created using Analyze
>menu and copied onto the Syntax window using "Paste."

It looks OK to me. You have a lot of EXECUTE. statements that aren't
necessary. But while they'll slow processing (whicn you likely won't
notice with a small file), they shouldn't make SPSS crash; the reverse,
more likely.

I'll make what more suggestions I can, very much not guaranteed. Again,
I could test your code, but I don't think it's worth doing, with
different releases and of course different installations.

>GET DATA  /TYPE = TXT
>    /FILE = 'C:\Documents and Settings\Owner'             +
>              '\My Documents\TOPS\psychosocial checklist' +
>              '\Psychosocial checklist data 2006'         +
>              ' tablim.txt'
>    /DELCASE = LINE
>    /DELIMITERS = "\t "
>    /ARRANGEMENT = DELIMITED
>    /FIRSTCASE = 2
>    /IMPORTCASE = ALL
>    /VARIABLES =
>     ID F2.1
>     camp F1.0
>     ns F1.0
>     bdayd F2.1
>     bdaym F2.1
>     bdayy F4.2
>     tdayd F2.1
>     tdaym F1.0
>     tdayy F4.2
>     nsd F2.1
>     nsm F1.0
>     nsy F4.2
>     Sex F1.0
>     Q1 F1.0
>     Q2 F1.0
>     Q3 F1.0
>     Q4 F1.0
>     Q5 F1.0
>     Q6 F1.0
>     Q7 F1.0
>     Q8 F1.0
>     Q9 F1.0
>     Q10 F1.0
>     Q11 F1.0
>     Q12 F1.0
>     Q13 F1.0
>     Q14 F1.0
>     Q15 F1.0
>     Q16 F1.0
>     Q17 F1.0
>     Q18 F1.0
>     Q19 F1.0
>     Q20 F1.0
>     Q21 F1.0
>     Q22 F1.0
>     Q23 F1.0
>     Q24 F1.0
>     Q25 F1.0
>     Q26 F1.0
>    .
>CACHE.

So you did go to reading a tab-delimited file, and it didn't work.
Well, it was a fair guess, but not good enough.

And CACHE also might have helped. Ah, well.

>EXECUTE.
>
>* Date and Time Wizard: birthdate.
>COMPUTE birthdate = DATE.DMY(bdayd, bdaym, bdayy).
>VARIABLE LABEL birthdate "birth date for the child".
>VARIABLE LEVEL birthdate (SCALE).
>FORMATS birthdate (SDATE10).
>VARIABLE WIDTH birthdate(10).
>EXECUTE.
>
>* Date and Time Wizard: todaydate.
>COMPUTE todaydate = DATE.DMY(tdayd, tdaym, tdayy).
>VARIABLE LABEL todaydate "the date the form was completed".
>VARIABLE LEVEL todaydate (SCALE).
>FORMATS todaydate (SDATE10).
>VARIABLE WIDTH todaydate(10).
>EXECUTE.
>
>* Date and Time Wizard: nsstartdate.
>COMPUTE nsstartdate = DATE.DMY(nsd, nsm, nsy).
>VARIABLE LABEL nsstartdate "the date the child started attending the
>nursery school".
>VARIABLE LEVEL nsstartdate (SCALE).
>FORMATS nsstartdate (SDATE10).
>VARIABLE WIDTH nsstartdate(10).
>EXECUTE.
>
>COMPUTE agestartns = DATEDIFF(nsstartdate, birthdate, "days") .
>EXECUTE .
>
>COMPUTE agetoday = DATEDIFF(todaydate, birthdate, "days") .
>EXECUTE .
>
>COMPUTE timeinns = DATEDIFF(todaydate, nsstartdate, "days") .
>EXECUTE .
>
>COMPUTE timeinnsm = DATEDIFF(todaydate, nsstartdate, "months") .
>EXECUTE .
>
>COMPUTE timeinnsy = DATEDIFF(todaydate, nsstartdate, "years") .
>EXECUTE .
>
>COMPUTE agestartnsm = DATEDIFF(nsstartdate, birthdate, "months") .
>EXECUTE .
>
>COMPUTE agestartnsy = DATEDIFF(nsstartdate, birthdate, "years") .
>EXECUTE .
>
>COMPUTE agetodaym = DATEDIFF(todaydate, birthdate, "months") .
>EXECUTE .
>
>COMPUTE agetodayy = DATEDIFF(todaydate, birthdate, "years") .
>EXECUTE .
>
>**Each of above variables (results of COMPUTE) sorted and any negative
>numbers (result of inaccurate dates reported) deleted by hand**

Fair enough, though it would be easy to do with syntax, something like
this:

RECODE agestartns  agetoday
        timeinns    timeinnsm   timeinnsy
        agestartnsm agestartnsy agetodaym agetodayy
        (0         = 0)
        (LO THRU 0 = SYSMIS).

On the whole I'd recommend it, as easier and more reliable. But doing
it your way certainly shouldn't crash SPSS.

Now, I'd try saving the file before running, another thing that *MIGHT*
help. Something like,

SAVE
    /OUTFILE = 'C:\Documents and Settings\Owner'             +
                 '\My Documents\TOPS\psychosocial checklist' +
                 '\Psychosocial checklist data 2006.SAV'.

And then reloading from the saved file every time. (The NEW FILE
commands shouldn't be necessary and theoretically make no difference,
but I want to do as much as possible to clear out the working file:

NEW FILE.
GET
       /FILE = 'C:\Documents and Settings\Owner'             +
                 '\My Documents\TOPS\psychosocial checklist' +
                 '\Psychosocial checklist data 2006.SAV'.

>FREQUENCIES
>  VARIABLES=Sex timeinnsy agestartnsy agetodayy
>  /ORDER=  ANALYSIS .

NEW FILE.
GET
       /FILE = 'C:\Documents and Settings\Owner'             +
                 '\My Documents\TOPS\psychosocial checklist' +
                 '\Psychosocial checklist data 2006.SAV'.

>CROSSTABS
>  /TABLES=agetodayy  BY Sex
>  /FORMAT= AVALUE TABLES
>  /STATISTIC=CHISQ
>  /CELLS= COUNT
>  /COUNT ROUND CELL .


(repeat GET FILE before each procedure.)


If AGGREGATE works, the CROSSTABS may work when run off the aggregated
file, like this. Here, you *MUST* reload and AGGREGATE each time, as
the aggregated file for one CROSSTABS is not usable for the next.

(NEW FILE and GET FILE)
AGGREGATE OUTFILE=*
    /BREAK  = agestartnsy  Sex
    /Cell_N = N.
WEIGHT BY Cell_N

* Then run the CROSSTABS, unchanged:.

>CROSSTABS
>  /TABLES=agestartnsy  BY Sex
>  /FORMAT= AVALUE TABLES
>  /STATISTIC=CHISQ
>  /CELLS= COUNT
>  /COUNT ROUND CELL .
>
>**With above, it does not crash but output has a row with all zeros in
>cells but the total is 161**

(NEW FILE and GET FILE)
AGGREGATE OUTFILE=*
    /BREAK  = timeinnsy Sex
    /Cell_N = N.
WEIGHT BY Cell_N

* Then run the CROSSTABS, unchanged:.

>CROSSTABS
>  /TABLES=timeinnsy  BY Sex
>  /FORMAT= AVALUE TABLES
>  /STATISTIC=CHISQ
>  /CELLS= COUNT
>  /COUNT ROUND CELL .

**CRASH!**

Sigh. I wish I could think of a certain way to fix it.

-Yours for better luck,
  Richard
Reply | Threaded
Open this post in threaded view
|

Re: Some errors running frequencies and crosstabs

Tanaka Akiko
Hi, Richard
The problem is mostly solved!!!!
I deleted with negative values using the syntax that you suggested (rather
than deleting by hand).  Then, all of a sudden, I was able to run crosstabs
without any problem!

The only thing is, even if I used the syntax, there was an zero that should
have been deleted automatically (it was length of time expressed in years,
and the same item expressed in number of days was negative) but did not, so
I still had to delete it by hand.  I don't know why it missed only that one
value, since it seems like SPSS deleted other zeros that were actually
negative--, but it's nothing compared to the other problem I was having. I
will have to save the data file after deleting that zero and use that file
instead of creating/opening it new every time (like you suggested), but at
least I can proceed with the analysis.

So, there must have been some weird time values that I missed when I was
deleting them by hand that screwed up the analysis.

This has also solved the first problem of having two rows of ",00"s in
crosstabs.

Thank you SO MUCH for helping me through the problems!  Your support has
been invaluable!
Akiko

>From: Richard Ristow <[hidden email]>
>To: Tanaka Akiko <[hidden email]>,[hidden email]
>Subject: Re: Some errors running frequencies and crosstabs
>Date: Wed, 23 May 2007 14:49:16 -0400
>
>At 12:56 AM 5/23/2007, Tanaka Akiko wrote:
>
>>Hi, Richard
>>
>>Thank you for all your suggestions! I tried all of them (except
>>LIST, but I scrolled through the data set and examined to see if
>>there are any weird values).  However, I still get the same errors.
>>
>>AGGREGATE worked, but I'm still not sure why I get the original
>>error, and if I don't correct the source of the problem, I imagine
>>running into the same kind of trouble in future analyses.
>
>I regret to say that sounds only too likely. And I don't see the
>problem. I could test your code, if you sent me data, but I've got
>SPSS 9, 14, and 15; testing with those, won't tell much about 13.
>And it may well not be SPSS 13 as such; as you thought, your
>particular installation may have gone bad in some way.
>
>>Here is the complete syntax.  Most of them were created using
>>Analyze menu and copied onto the Syntax window using "Paste."
>
>It looks OK to me. You have a lot of EXECUTE. statements that aren't
>necessary. But while they'll slow processing (whicn you likely won't
>notice with a small file), they shouldn't make SPSS crash; the
>reverse, more likely.
>
>I'll make what more suggestions I can, very much not guaranteed.
>Again, I could test your code, but I don't think it's worth doing,
>with different releases and of course different installations.
>
>>GET DATA  /TYPE = TXT
>>    /FILE = 'C:\Documents and Settings\Owner'             +
>>              '\My Documents\TOPS\psychosocial checklist' +
>>              '\Psychosocial checklist data 2006'         +
>>              ' tablim.txt'
>>    /DELCASE = LINE
>>    /DELIMITERS = "\t "
>>    /ARRANGEMENT = DELIMITED
>>    /FIRSTCASE = 2
>>    /IMPORTCASE = ALL
>>    /VARIABLES =
>>     ID F2.1
>>     camp F1.0
>>     ns F1.0
>>     bdayd F2.1
>>     bdaym F2.1
>>     bdayy F4.2
>>     tdayd F2.1
>>     tdaym F1.0
>>     tdayy F4.2
>>     nsd F2.1
>>     nsm F1.0
>>     nsy F4.2
>>     Sex F1.0
>>     Q1 F1.0
>>     Q2 F1.0
>>     Q3 F1.0
>>     Q4 F1.0
>>     Q5 F1.0
>>     Q6 F1.0
>>     Q7 F1.0
>>     Q8 F1.0
>>     Q9 F1.0
>>     Q10 F1.0
>>     Q11 F1.0
>>     Q12 F1.0
>>     Q13 F1.0
>>     Q14 F1.0
>>     Q15 F1.0
>>     Q16 F1.0
>>     Q17 F1.0
>>     Q18 F1.0
>>     Q19 F1.0
>>     Q20 F1.0
>>     Q21 F1.0
>>     Q22 F1.0
>>     Q23 F1.0
>>     Q24 F1.0
>>     Q25 F1.0
>>     Q26 F1.0
>>    .
>>CACHE.
>
>So you did go to reading a tab-delimited file, and it didn't work.
>Well, it was a fair guess, but not good enough.
>
>And CACHE also might have helped. Ah, well.
>
>>EXECUTE.
>>
>>* Date and Time Wizard: birthdate.
>>COMPUTE birthdate = DATE.DMY(bdayd, bdaym, bdayy).
>>VARIABLE LABEL birthdate "birth date for the child".
>>VARIABLE LEVEL birthdate (SCALE).
>>FORMATS birthdate (SDATE10).
>>VARIABLE WIDTH birthdate(10).
>>EXECUTE.
>>
>>* Date and Time Wizard: todaydate.
>>COMPUTE todaydate = DATE.DMY(tdayd, tdaym, tdayy).
>>VARIABLE LABEL todaydate "the date the form was completed".
>>VARIABLE LEVEL todaydate (SCALE).
>>FORMATS todaydate (SDATE10).
>>VARIABLE WIDTH todaydate(10).
>>EXECUTE.
>>
>>* Date and Time Wizard: nsstartdate.
>>COMPUTE nsstartdate = DATE.DMY(nsd, nsm, nsy).
>>VARIABLE LABEL nsstartdate "the date the child started attending
>>the
>>nursery school".
>>VARIABLE LEVEL nsstartdate (SCALE).
>>FORMATS nsstartdate (SDATE10).
>>VARIABLE WIDTH nsstartdate(10).
>>EXECUTE.
>>
>>COMPUTE agestartns = DATEDIFF(nsstartdate, birthdate, "days") .
>>EXECUTE .
>>
>>COMPUTE agetoday = DATEDIFF(todaydate, birthdate, "days") .
>>EXECUTE .
>>
>>COMPUTE timeinns = DATEDIFF(todaydate, nsstartdate, "days") .
>>EXECUTE .
>>
>>COMPUTE timeinnsm = DATEDIFF(todaydate, nsstartdate, "months") .
>>EXECUTE .
>>
>>COMPUTE timeinnsy = DATEDIFF(todaydate, nsstartdate, "years") .
>>EXECUTE .
>>
>>COMPUTE agestartnsm = DATEDIFF(nsstartdate, birthdate, "months") .
>>EXECUTE .
>>
>>COMPUTE agestartnsy = DATEDIFF(nsstartdate, birthdate, "years") .
>>EXECUTE .
>>
>>COMPUTE agetodaym = DATEDIFF(todaydate, birthdate, "months") .
>>EXECUTE .
>>
>>COMPUTE agetodayy = DATEDIFF(todaydate, birthdate, "years") .
>>EXECUTE .
>>
>>**Each of above variables (results of COMPUTE) sorted and any
>>negative numbers (result of inaccurate dates reported) deleted by
>>hand**
>
>Fair enough, though it would be easy to do with syntax, something
>like this:
>
>RECODE agestartns  agetoday
>        timeinns    timeinnsm   timeinnsy
>        agestartnsm agestartnsy agetodaym agetodayy
>        (0         = 0)
>        (LO THRU 0 = SYSMIS).
>
>On the whole I'd recommend it, as easier and more reliable. But
>doing it your way certainly shouldn't crash SPSS.
>
>Now, I'd try saving the file before running, another thing that
>*MIGHT* help. Something like,
>
>SAVE
>    /OUTFILE = 'C:\Documents and Settings\Owner'             +
>                 '\My Documents\TOPS\psychosocial checklist' +
>                 '\Psychosocial checklist data 2006.SAV'.
>
>And then reloading from the saved file every time. (The NEW FILE
>commands shouldn't be necessary and theoretically make no
>difference, but I want to do as much as possible to clear out the
>working file:
>
>NEW FILE.
>GET
>       /FILE = 'C:\Documents and Settings\Owner'             +
>                 '\My Documents\TOPS\psychosocial checklist' +
>                 '\Psychosocial checklist data 2006.SAV'.
>
>>FREQUENCIES
>>  VARIABLES=Sex timeinnsy agestartnsy agetodayy
>>  /ORDER=  ANALYSIS .
>
>NEW FILE.
>GET
>       /FILE = 'C:\Documents and Settings\Owner'             +
>                 '\My Documents\TOPS\psychosocial checklist' +
>                 '\Psychosocial checklist data 2006.SAV'.
>
>>CROSSTABS
>>  /TABLES=agetodayy  BY Sex
>>  /FORMAT= AVALUE TABLES
>>  /STATISTIC=CHISQ
>>  /CELLS= COUNT
>>  /COUNT ROUND CELL .
>
>
>(repeat GET FILE before each procedure.)
>
>
>If AGGREGATE works, the CROSSTABS may work when run off the
>aggregated file, like this. Here, you *MUST* reload and AGGREGATE
>each time, as the aggregated file for one CROSSTABS is not usable
>for the next.
>
>(NEW FILE and GET FILE)
>AGGREGATE OUTFILE=*
>    /BREAK  = agestartnsy  Sex
>    /Cell_N = N.
>WEIGHT BY Cell_N
>
>* Then run the CROSSTABS, unchanged:.
>
>>CROSSTABS
>>  /TABLES=agestartnsy  BY Sex
>>  /FORMAT= AVALUE TABLES
>>  /STATISTIC=CHISQ
>>  /CELLS= COUNT
>>  /COUNT ROUND CELL .
>>
>>**With above, it does not crash but output has a row with all zeros
>>in
>>cells but the total is 161**
>
>(NEW FILE and GET FILE)
>AGGREGATE OUTFILE=*
>    /BREAK  = timeinnsy Sex
>    /Cell_N = N.
>WEIGHT BY Cell_N
>
>* Then run the CROSSTABS, unchanged:.
>
>>CROSSTABS
>>  /TABLES=timeinnsy  BY Sex
>>  /FORMAT= AVALUE TABLES
>>  /STATISTIC=CHISQ
>>  /CELLS= COUNT
>>  /COUNT ROUND CELL .
>
>**CRASH!**
>
>Sigh. I wish I could think of a certain way to fix it.
>
>-Yours for better luck,
>  Richard

_________________________________________________________________
 $B=*N;4V6a!*%a%C%;%s%8%c!<$N%?%V$G!"%j%"!&%G%#%>%s$N8BDjJI;f$rG[I[Cf (B
http://campaign.live.jp/dizon/
Reply | Threaded
Open this post in threaded view
|

Re: Some errors running frequencies and crosstabs

Tanaka Akiko
In reply to this post by Tanaka Akiko
Below posting was rejected.  I deleted the old section of the mail, so
hopefully this one will be OK.
Hi, Richard
The problem is mostly solved!!!!
I deleted with negative values using the syntax that you suggested (rather
than deleting by hand).  Then, all of a sudden, I was able to run crosstabs
without any problem!

The only thing is, even if I used the syntax, there was an zero that should
have been deleted automatically (it was length of time expressed in years,
and the same item expressed in number of days was negative) but did not, so
I still had to delete it by hand.  I don't know why it missed only that one
value, since it seems like SPSS deleted other zeros that were actually
negative--, but it's nothing compared to the other problem I was having. I
will have to save the data file after deleting that zero and use that file
instead of creating/opening it new every time (like you suggested), but at
least I can proceed with the analysis.

So, there must have been some weird time values that I missed when I was
deleting them by hand that screwed up the analysis.

This has also solved the first problem of having two rows of ",00"s in
crosstabs.

Thank you SO MUCH for helping me through the problems!  Your support has
been invaluable!
Akiko

_________________________________________________________________
 $B0lEY;H$C$?$i$d$a$i$l$J$$!*!) (BMSN $B!" (BWindows Live  $B8~$1$N:G?7%V%i%&%6$O$3$A$i (B
http://promotion.msn.co.jp/ie7/