Help with Command for Aggregate File

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

Help with Command for Aggregate File

Jordan Hertl
Hi all,

I have an aggregate file for SPSS, and I was trying to determine how to get the number of responses for an option on a variable. 

So for example....I have variable "q1"  and you could have selected that you taught English (1), Math (2) or Science (3). 

I know how to get the percentage of teachers that picked English (1), but how would I get the number of teacher's that selected English (1) for q1?

Thank you,

Jordan
Reply | Threaded
Open this post in threaded view
|

Re: Help with Command for Aggregate File

Maguin, Eugene

Jordan,

 

Maybe somebody else will understand but I don’t. You say you have an ‘aggregate file’. How is that different from a standard data file of rows as respondents and columns as variables? What are the rows in your file?

 

If you had a standard data file, I imagine teachers were rows and q1 was the variable you describe. So then a frequencies command will give you the percentages of teacher-respondents that taught the three different subjects. And the frequencies report will show the N for each response and that seems to be what you want as the number of teachers that selected ‘English’.

 

Gene Maguin

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jordan Hertl
Sent: Thursday, May 10, 2012 4:18 PM
To: [hidden email]
Subject: Help with Command for Aggregate File

 

Hi all,

I have an aggregate file for SPSS, and I was trying to determine how to get the number of responses for an option on a variable. 

So for example....I have variable "q1"  and you could have selected that you taught English (1), Math (2) or Science (3). 

I know how to get the percentage of teachers that picked English (1), but how would I get the number of teacher's that selected English (1) for q1?

Thank you,

Jordan

Reply | Threaded
Open this post in threaded view
|

Re: Help with Command for Aggregate File

David Marso
Administrator
In reply to this post by Jordan Hertl
Jordan,
It would help if you provided a better description of this 'aggregate file' .
ie,
What information does it contain?  
How is it structured?...
How would you go about getting the percent?  
What is the obstacle for getting the count?
--
Jordan Hertl wrote
Hi all,

I have an aggregate file for SPSS, and I was trying to determine how to get
the number of responses for an option on a variable.

So for example....I have variable "q1"  and you could have selected that
you taught English (1), Math (2) or Science (3).

I know how to get the percentage of teachers that picked English (1), but
how would I get the number of teacher's that selected English (1) for q1?

Thank you,

Jordan
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Help with Command for Aggregate File

Bruce Weaver
Administrator
I agree with David that more info is needed.  However, I think my InterneTelepathy may have worked in this case.  (Fools rush in.)  I think what Jordan means is that he has used the PIN function of AGGREGATE to get the percentages for each value of Q1; but what he can't work out is how to convert those percentages into actual numbers.  Is that right, Jordan?  If so, you could have AGGREGATE also save the total NUMBER of cases that have valid data for q1, and then multiply the percentage (or better, the proportion) for each value of Q1 times the total N to get the number checking each value.  You might want to round the result too.  Here's an example:

data list free / q1(f1).
begin data
1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3
end data.

AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=
  /q1_p1=FIN(q1 1 1)
  /q1_p2=FIN(q1 2 2)
  /q1_p3=FIN(q1 3 3)
  /q1_nu=NU(q1).

DO REPEAT C = q1_1count q1_2count q1_3count / P = q1_p1 to q1_p3 .
- COMPUTE C = rnd(q1_nu*P).
END REPEAT.
FORMATS Q1_1count to q1_3count (f2.0).
LIST.

Output:

q1 q1_p1 q1_p2 q1_p3   q1_nu q1_1count q1_2count q1_3count

 1  .323  .419  .258      31     10        13         8
 1  .323  .419  .258      31     10        13         8
 1  .323  .419  .258      31     10        13         8
 1  .323  .419  .258      31     10        13         8
 1  .323  .419  .258      31     10        13         8
 1  .323  .419  .258      31     10        13         8
 1  .323  .419  .258      31     10        13         8
 1  .323  .419  .258      31     10        13         8
 1  .323  .419  .258      31     10        13         8
 1  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 2  .323  .419  .258      31     10        13         8
 3  .323  .419  .258      31     10        13         8
 3  .323  .419  .258      31     10        13         8
 3  .323  .419  .258      31     10        13         8
 3  .323  .419  .258      31     10        13         8
 3  .323  .419  .258      31     10        13         8
 3  .323  .419  .258      31     10        13         8
 3  .323  .419  .258      31     10        13         8
 3  .323  .419  .258      31     10        13         8

Number of cases read:  31    Number of cases listed:  31

HTH.

 

David Marso wrote
Jordan,
It would help if you provided a better description of this 'aggregate file' .
ie,
What information does it contain?  
How is it structured?...
How would you go about getting the percent?  
What is the obstacle for getting the count?
--
Jordan Hertl wrote
Hi all,

I have an aggregate file for SPSS, and I was trying to determine how to get
the number of responses for an option on a variable.

So for example....I have variable "q1"  and you could have selected that
you taught English (1), Math (2) or Science (3).

I know how to get the percentage of teachers that picked English (1), but
how would I get the number of teacher's that selected English (1) for q1?

Thank you,

Jordan
--
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: Help with Command for Aggregate File

Melissa Ives
In reply to this post by Jordan Hertl

If you want to convert the percent into an N, multiply each percent by the total number of records.

 

i.e. if it were gender and you have 200 cases in the original file and the pin(female) is 35%, then you would have .35*200 = 70 females.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jordan Hertl
Sent: Thursday, May 10, 2012 3:18 PM
To: [hidden email]
Subject: [SPSSX-L] Help with Command for Aggregate File

 

Hi all,

I have an aggregate file for SPSS, and I was trying to determine how to get the number of responses for an option on a variable. 

So for example....I have variable "q1"  and you could have selected that you taught English (1), Math (2) or Science (3). 

I know how to get the percentage of teachers that picked English (1), but how would I get the number of teacher's that selected English (1) for q1?

Thank you,

Jordan



PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.
Reply | Threaded
Open this post in threaded view
|

Re: Help with Command for Aggregate File

Jordan Hertl
I apologize for not providing adequate information in my previous email. 

Bruce was right in that I am using the PIN function....and that I could not work out how to get the actual numbers.  So your internet telepathy is fully functional. 

Here is what I was using...

AGGREGATE
/OUTFILE= 'C:\Documents and Settings\Desktop\SPSS Syntax Files\aggfileTEACHER.sav'
/BREAK=Code
/n "Total Teachers" = N
/totaleng "Teaching English" = PIN (q1 1 1)
/totalmath "Teaching Math" = PIN (q1 2 2)
/totalscience "Teaching Science" = PIN (q1 3 3).

Thank you for your previous help.

Jordan

On Thu, May 10, 2012 at 5:00 PM, Melissa Ives <[hidden email]> wrote:

If you want to convert the percent into an N, multiply each percent by the total number of records.

 

i.e. if it were gender and you have 200 cases in the original file and the pin(female) is 35%, then you would have .35*200 = 70 females.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jordan Hertl


Sent: Thursday, May 10, 2012 3:18 PM
To: [hidden email]
Subject: [SPSSX-L] Help with Command for Aggregate File

 

Hi all,

I have an aggregate file for SPSS, and I was trying to determine how to get the number of responses for an option on a variable. 

So for example....I have variable "q1"  and you could have selected that you taught English (1), Math (2) or Science (3). 

I know how to get the percentage of teachers that picked English (1), but how would I get the number of teacher's that selected English (1) for q1?

Thank you,

Jordan



PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at <a href="tel:%28309%29%20827-6026" value="+13098276026" target="_blank">(309) 827-6026 for assistance.

Reply | Threaded
Open this post in threaded view
|

Automatic reply: Help with Command for Aggregate File

Marhefka, Stephanie

Hello. I will be out of the office  until Monday, May 14, 2012. I will do my best to respond to you upon my return.

 

Thank you,

Stephanie L. Marhefka, Ph.D.

 

Reply | Threaded
Open this post in threaded view
|

Re: Help with Command for Aggregate File

David Marso
Administrator
In reply to this post by Jordan Hertl
AGGREGATE
/OUTFILE= 'C:\Documents and Settings\Desktop\SPSS Syntax Files\aggfileTEACHERNforQ1.sav'
/BREAK=Code q1
/N "Count for categories of q1 within values of CODE " = N.
**
If you have many vars to process then precede with VARSTOCASES or LOOP/XSAVE.
-----------------------------------------------
Jordan Hertl wrote
I apologize for not providing adequate information in my previous email.

Bruce was right in that I am using the PIN function....and that I could not
work out how to get the actual numbers.  So your internet telepathy is
fully functional.

Here is what I was using...

AGGREGATE
/OUTFILE= 'C:\Documents and Settings\Desktop\SPSS Syntax
Files\aggfileTEACHER.sav'
/BREAK=Code
/n "Total Teachers" = N
/totaleng "Teaching English" = PIN (q1 1 1)
/totalmath "Teaching Math" = PIN (q1 2 2)
/totalscience "Teaching Science" = PIN (q1 3 3).

Thank you for your previous help.

Jordan

On Thu, May 10, 2012 at 5:00 PM, Melissa Ives <[hidden email]> wrote:

>  If you want to convert the percent into an N, multiply each percent by
> the total number of records.****
>
> ** **
>
> i.e. if it were gender and you have 200 cases in the original file and the
> pin(female) is 35%, then you would have .35*200 = 70 females.****
>
> ** **
>
> *From:* SPSSX(r) Discussion [mailto:[hidden email]] *On Behalf
> Of *Jordan Hertl
>
> *Sent:* Thursday, May 10, 2012 3:18 PM
> *To:* [hidden email]
> *Subject:* [SPSSX-L] Help with Command for Aggregate File****
>
> ** **
>
> Hi all,
>
> I have an aggregate file for SPSS, and I was trying to determine how to
> get the number of responses for an option on a variable.
>
> So for example....I have variable "q1"  and you could have selected that
> you taught English (1), Math (2) or Science (3).
>
> I know how to get the percentage of teachers that picked English (1), but
> how would I get the number of teacher's that selected English (1) for q1?
>
> Thank you,
>
> Jordan****
>
> ------------------------------
> PRIVILEGED AND CONFIDENTIAL INFORMATION
> This transmittal and any attachments may contain PRIVILEGED AND
> CONFIDENTIAL information and is intended only for the use of the
> addressee. If you are not the designated recipient, or an employee
> or agent authorized to deliver such transmittals to the designated
> recipient, you are hereby notified that any dissemination,
> copying or publication of this transmittal is strictly prohibited. If
> you have received this transmittal in error, please notify us
> immediately by replying to the sender and delete this copy from your
> system. You may also call us at (309) 827-6026 for assistance.
>
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"