Counting data in multiple columns

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

Counting data in multiple columns

Paul Sillitoe

Please forgive this no doubt basic query, for which I cannot find a solution:

 

  1. Using PASW 17.0.2 on WinXP Home Edn.

 

  1. I have a 400-case (row) dataset.

 

  1. I wish to count the frequencies of occurrence of data in multiple columns.

 

  1. I am looking for a standard method which I can adapt and apply to many different cases of such column-counting.

 

  1. For example:

 

Column 1 = Signature A

Column 2 = Signature B

Column 3 = Signature C

Column 4 = Signature D

 

  1. The Data Value Labels which may be present for any case in any column, typically include:

 

“Present”

“Annotation”

“Label”

 

  1. Although the data are obviously coded it will be more convenient to deal directly with the Data Value Labels.

 

  1. I wish to count a column as being included if it contains any of these data values. An example query therefore is:

 

·         Find every case that contains any data value in Columns A, B, D, but not C.

·         Count and present the total number of these cases.

 

  1. I need only produce a table with the results;charts are not required.

 

Thank you.

 

Paul S.

 

Reply | Threaded
Open this post in threaded view
|

Re: Counting data in multiple columns

Marks, Jim

Paul:

 

Have you looked at the COUNT command? It can be used to count occurrences of a value across columns.

 

Can you post some sample data and desired result? It is unclear to me what you are looking to do.

 

Jim Marks

Director, Market Research

x1616

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Paul Sillitoe
Sent: Friday, May 07, 2010 8:56 AM
To: [hidden email]
Subject: Counting data in multiple columns

 

Please forgive this no doubt basic query, for which I cannot find a solution:

 

  1. Using PASW 17.0.2 on WinXP Home Edn.

 

  1. I have a 400-case (row) dataset.

 

  1. I wish to count the frequencies of occurrence of data in multiple columns.

 

  1. I am looking for a standard method which I can adapt and apply to many different cases of such column-counting.

 

  1. For example:

 

Column 1 = Signature A

Column 2 = Signature B

Column 3 = Signature C

Column 4 = Signature D

 

  1. The Data Value Labels which may be present for any case in any column, typically include:

 

“Present”

“Annotation”

“Label”

 

  1. Although the data are obviously coded it will be more convenient to deal directly with the Data Value Labels.

 

  1. I wish to count a column as being included if it contains any of these data values. An example query therefore is:

 

·         Find every case that contains any data value in Columns A, B, D, but not C.

·         Count and present the total number of these cases.

 

  1. I need only produce a table with the results;charts are not required.

 

Thank you.

 

Paul S.

 

Reply | Threaded
Open this post in threaded view
|

Factor analysis with correlation matrix

Zana Dael
I so need help.
 
 
to create my own syntax with my own correlation matrix. My modifed syntax follows. When I try to run this in PASW 18, I get more errors than I know what to do with. My ultimate goal is to run a higher-order factor analysis.
 
Thanks so much for your help.
 
Zedi
 

MATRIX DATA VARIABLES=V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
/contents=corr
/N=1657.
BEGIN DATA.
1.000                                                                                                                                                     

.357        1.000                                                                                                                                     

.244        .246        1.000                                                                                                                     

.361        .002        .319        1.000                                                                                                     

.023        .028        .321        .351        1.000                                                                                     

.510        .175        .117        .344        .008        1.000                                                                     

.168        .190        .093        .013        -.012       .357        1.000                                                     

.185        .217        .118        .001        .008        .349        .385        1.000                                     

.286        .335        .346        .201        .218        .294        .294        .315        1.000                     

.116        .108        .353        .291        .269        .229        .215        .229        .345        1.000     

.357        .389        .423        .222        .260        .345        .324        .344        .495        .380        1.000

END DATA.
EXECUTE.

 

FACTOR MATRIX=IN(COR=*)
/PRINT= EXTRACTION ROTATION CORRELATION REPR
/PLOT EIGEN ROTATION
 /CRITERIA MINEIGEN(1) ITERATE(25)
/EXTRACTION=PC
 /ROTATION=PROMAX
 /METHOD=CORRELATION.

 

FACTOR MATRIX=IN(COR=*)
/PRINT= EXTRACTION ROTATION
/PLOT EIGEN ROTATION
 /CRITERIA MINEIGEN(.45) ITERATE(25)
/EXTRACTION=PC
 /ROTATION=PROMAX
 /METHOD=CORRELATION.


FACTOR MATRIX=IN(COR=*)
/PRINT= ALL
/PLOT EIGEN ROTATION
 /CRITERIA MINEIGEN(1) ITERATE(25)
/EXTRACTION=PAF
 /ROTATION=PROMAX
 /METHOD=CORRELATION.

 



Reply | Threaded
Open this post in threaded view
|

Re: Factor analysis with correlation matrix

J P-6
Have you considered using specialized software, such as MX which is free?
 

 


From: Zd Gibbs <[hidden email]>
To: [hidden email]
Sent: Fri, May 7, 2010 12:04:54 PM
Subject: Factor analysis with correlation matrix

I so need help.
 
I am using the syntax in the article http://www.psychstat.org/us/article.php/40.htm also on this website http://www.psychstat.org/us/article.php/40.htm-Factor%20analysis%20based%20on%20correlation%20matrix%20in%20SPSS 
 
to create my own syntax with my own correlation matrix. My modifed syntax follows. When I try to run this in PASW 18, I get more errors than I know what to do with. My ultimate goal is to run a higher-order factor analysis.
 
Thanks so much for your help.
 
Zedi
 

MATRIX DATA VARIABLES=V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
/contents=corr
/N=1657.
BEGIN DATA.
1.000                                                                                                                                                     

.357        1.000                                                                                                                                     

.244        .246        1.000                                                                                                                     

.361        .002        .319        1.000                                                                                                     

.023        .028        .321        .351        1.000                                                                                     

.510        .175        .117        .344        .008        1.000                                                                     

.168        .190        .093        .013        -.012       .357        1.000                                                     

.185        .217        .118        .001        .008        .349        .385        1.000                                     

.286        .335        .346        .201        .218        .294        .294        .315        1.000                     

.116        .108        .353        .291        .269        .229        .215        .229        .345        1.000     

.357        .389        .423        .222        .260        .345        .324        .344        .495        .380        1.000

END DATA.
EXECUTE.

 

FACTOR MATRIX=IN(COR=*)
/PRINT= EXTRACTION ROTATION CORRELATION REPR
/PLOT EIGEN ROTATION
 /CRITERIA MINEIGEN(1) ITERATE(25)
/EXTRACTION=PC
 /ROTATION=PROMAX
 /METHOD=CORRELATION.

 

FACTOR MATRIX=IN(COR=*)
/PRINT= EXTRACTION ROTATION
/PLOT EIGEN ROTATION
 /CRITERIA MINEIGEN(.45) ITERATE(25)
/EXTRACTION=PC
 /ROTATION=PROMAX
 /METHOD=CORRELATION.


FACTOR MATRIX=IN(COR=*)
/PRINT= ALL
/PLOT EIGEN ROTATION
 /CRITERIA MINEIGEN(1) ITERATE(25)
/EXTRACTION=PAF
 /ROTATION=PROMAX
 /METHOD=CORRELATION.

 




Reply | Threaded
Open this post in threaded view
|

Re: Factor analysis with correlation matrix

Richard Ristow
In reply to this post by Zana Dael
At 12:04 PM 5/7/2010, Zd Gibbs wrote:

>I am using the syntax in the article
>http://www.psychstat.org/us/article.php/40.htm also on this website
>http://www.psychstat.org/us/article.php/40.htm-Factor%20analysis%20based%20on%20correlation%20matrix%20in%20SPSS
>
>
>to create my own syntax with my own correlation matrix. My modifed
>syntax follows. When I try to run this in PASW 18, I get more errors
>than I know what to do with.

Post the results of a run, with all input, all output, and the error messages.

You have a problem or you wouldn't be getting the messages, but you
probably don't have as many problems as it may seem. Many programming
systems exhibit "propagation of errors", where one syntax error
causes something not to be defined as intended and later statements
become invalid in the (broken) context; and SPSS is particularly
prone. It's likely that you just have one or two small things wrong.

-Best wishes,
  Richard

=====================
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: Counting data in multiple columns

Albert-Jan Roskam
In reply to this post by Marks, Jim
Hi,

I'm also not completely sure what you want. In addition to the COUNT command, you might also be interested in ANY (I think it can be found under COMPUTE):
COMPUTE outcome = ANY(1, var1, var2, var3).
This would create a binary variable that is one if any of the vars equals one, and zero otherwise.
To finish it off, you could use AGGREGATE to sum up the outcome variable.

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- On Fri, 5/7/10, Marks, Jim <[hidden email]> wrote:

From: Marks, Jim <[hidden email]>
Subject: Re: [SPSSX-L] Counting data in multiple columns
To: [hidden email]
Date: Friday, May 7, 2010, 5:05 PM

Paul:

 

Have you looked at the COUNT command? It can be used to count occurrences of a value across columns.

 

Can you post some sample data and desired result? It is unclear to me what you are looking to do.

 

Jim Marks

Director, Market Research

x1616

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Paul Sillitoe
Sent: Friday, May 07, 2010 8:56 AM
To: [hidden email]
Subject: Counting data in multiple columns

 

Please forgive this no doubt basic query, for which I cannot find a solution:

 

  1. Using PASW 17.0.2 on WinXP Home Edn.

 

  1. I have a 400-case (row) dataset.

 

  1. I wish to count the frequencies of occurrence of data in multiple columns.

 

  1. I am looking for a standard method which I can adapt and apply to many different cases of such column-counting.

 

  1. For example:

 

Column 1 = Signature A

Column 2 = Signature B

Column 3 = Signature C

Column 4 = Signature D

 

  1. The Data Value Labels which may be present for any case in any column, typically include:

 

“Present”

“Annotation”

“Label”

 

  1. Although the data are obviously coded it will be more convenient to deal directly with the Data Value Labels.

 

  1. I wish to count a column as being included if it contains any of these data values. An example query therefore is:

 

·         Find every case that contains any data value in Columns A, B, D, but not C.

·         Count and present the total number of these cases.

 

  1. I need only produce a table with the results;charts are not required.

 

Thank you.

 

Paul S.

 


Reply | Threaded
Open this post in threaded view
|

Re: Factor analysis with correlation matrix

Ryan
In reply to this post by Zana Dael
Zedi,

I decided to run your code in PASW18, and the only error I receive is for the last factor analysis. The error message states that you cannot obtain the covariance matrix since you did not provide standard deviations in the input matrix. I also noticed that the descriptives table is blank. None of this should be surprising to you. Aside from that, everything runs smoothly.

Exactly what errors are you seeing?

Ryan

Zana Dael wrote
I so need help.

I am using the syntax in the article http://www.psychstat.org/us/article.php/40.htm also on this website http://www.psychstat.org/us/article.php/40.htm-Factor%20analysis%20based%20on%20correlation%20matrix%20in%20SPSS 
 
to createmy own syntax with my own correlation matrix. My modifed syntax follows. When I try to run this in PASW 18, I get more errors than I know what to do with. My ultimate goal is to run a higher-order factor analysis.
 
Thanks so much for your help.
 
Zedi
 
MATRIX DATA VARIABLES=V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
/contents=corr
/N=1657.
BEGIN DATA.
1.000                                                                                                                                                     
.357        1.000                                                                                                                                     
.244        .246        1.000                                                                                                                     
.361        .002        .319        1.000                                                                                                     
.023        .028        .321        .351        1.000                                                                                     
.510        .175        .117        .344        .008        1.000                                                                     
.168        .190        .093        .013        -.012       .357        1.000                                                     
.185        .217        .118        .001        .008        .349        .385        1.000                                     
.286        .335        .346        .201        .218        .294        .294        .315        1.000                     
.116        .108        .353        .291        .269        .229        .215        .229        .345        1.000     
.357        .389        .423        .222        .260        .345        .324        .344        .495        .380        1.000
END DATA.
EXECUTE.
 
FACTOR MATRIX=IN(COR=*)
/PRINT= EXTRACTION ROTATION CORRELATION REPR
/PLOT EIGEN ROTATION
 /CRITERIA MINEIGEN(1) ITERATE(25)
/EXTRACTION=PC
 /ROTATION=PROMAX
 /METHOD=CORRELATION.
 
FACTOR MATRIX=IN(COR=*)
/PRINT= EXTRACTION ROTATION
/PLOT EIGEN ROTATION
 /CRITERIA MINEIGEN(.45) ITERATE(25)
/EXTRACTION=PC
 /ROTATION=PROMAX
 /METHOD=CORRELATION.

FACTOR MATRIX=IN(COR=*)
/PRINT= ALL
/PLOT EIGEN ROTATION
 /CRITERIA MINEIGEN(1) ITERATE(25)
/EXTRACTION=PAF
 /ROTATION=PROMAX
 /METHOD=CORRELATION.

Reply | Threaded
Open this post in threaded view
|

Re: Factor analysis with correlation matrix

Marta Garcia-Granero
In reply to this post by Zana Dael
Zd Gibbs wrote:

> I so need help.
>
> I am using the syntax in the article
> http://www.psychstat.org/us/article.php/40.htm also on this website
> http://www.psychstat.org/us/article.php/40.htm-Factor%20analysis%20based%20on%20correlation%20matrix%20in%20SPSS
>
> to create my own syntax with my own correlation matrix. My modifed
> syntax follows. When I try to run this in PASW 18, I get more errors
> than I know what to do with. My ultimate goal is to run a higher-order
> factor analysis.

Hi Zedi:

I have tried your syntax on PASW 18, and it runs OK, with the exception
of a single warning on the third FACTOR analysis:

Warnings
The covariance matrix cannot be printed because the ROWTYPE_ variable in
the matrix input file does not contain the value 'STDDEV '.

You should try to split the execution of the code into parts: first, you
run the MATRIX...END DATA.  portion. Examine the dataset, see if it
corresponds to what yo expected, and the try the first FACTOR analysis,
examine the results.. and so on.

Which country do you live in? Perhaps the problem is that the default
value for the decimal separator (as specified by the O.S.) for your
country is a comma (like in mine), and then the bunch of error messages
you see is caused simply by the fact that the correlations are NOT read
correctly.

If the correlation matrix is not generated correctly, try this
modification of the syntax:

TEMPORARY.
SET LOCALE=ENGLISH.
MATRIX DATA VARIABLES=V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
/contents=corr
/N=1657.
BEGIN DATA.
1.000

.357
1.000

.244        .246
1.000

.361        .002        .319
1.000

.023        .028        .321        .351
1.000

.510        .175        .117        .344        .008
1.000
.168        .190        .093        .013        -.012       .357
1.000
.185        .217        .118        .001        .008        .349
.385        1.000
.286        .335        .346        .201        .218        .294
.294        .315        1.000
.116        .108        .353        .291        .269        .229
.215        .229        .345        1.000
.357        .389        .423        .222        .260        .345
.324        .344        .495        .380        1.000
END DATA.
EXECUTE.
RESTORE.

HTH,
Marta GG


>
>
> MATRIX DATA VARIABLES=V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
> /contents=corr
> /N=1657.
> BEGIN DATA.
> 1.000
>
>
> .357
> 1.000
>
>
> .244        .246
> 1.000
>
>
> .361        .002        .319
> 1.000
>
>
> .023        .028        .321        .351
> 1.000
>
>
> .510        .175        .117        .344        .008
> 1.000
>
>
> .168        .190        .093        .013        -.012
> .357        1.000
>
> .185        .217        .118        .001        .008
> .349        .385        1.000
>
> .286        .335        .346        .201        .218
> .294        .294        .315        1.000
>
> .116        .108        .353        .291        .269
> .229        .215        .229        .345        1.000
>
> .357        .389        .423        .222        .260
> .345        .324        .344        .495        .380        1.000
>
> END DATA.
> EXECUTE.
>
>
>
> FACTOR MATRIX=IN(COR=*)
> /PRINT= EXTRACTION ROTATION CORRELATION REPR
> /PLOT EIGEN ROTATION
>  /CRITERIA MINEIGEN(1) ITERATE(25)
> /EXTRACTION=PC
>  /ROTATION=PROMAX
>  /METHOD=CORRELATION.
>
>
>
> FACTOR MATRIX=IN(COR=*)
> /PRINT= EXTRACTION ROTATION
> /PLOT EIGEN ROTATION
>  /CRITERIA MINEIGEN(.45) ITERATE(25)
> /EXTRACTION=PC
>  /ROTATION=PROMAX
>  /METHOD=CORRELATION.
>
>
> FACTOR MATRIX=IN(COR=*)
> /PRINT= ALL
> /PLOT EIGEN ROTATION
>  /CRITERIA MINEIGEN(1) ITERATE(25)
> /EXTRACTION=PAF
>  /ROTATION=PROMAX
>  /METHOD=CORRELATION.
>
>
>
>
>


--
For miscellaneous SPSS related 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