Frequencies for subgroups

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

Frequencies for subgroups

Mark Vande Kamp-2
I am currently using the code below to get frequency outputs for specified subgroups

TEMPORARY.
SELECT IF (Month1stFIC = 1).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 2).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 3).
FREQUENCIES Sessions.

I'd like to make the syntax work for added months without repeating the blocks of code as above.

If I could avoid the SplitFile command (and its required sort) that would be good too -- the sort takes forever because it's a huge file.

Is there another way?

Mark

=====================
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: Frequencies for subgroups

Rick Oliver-3
If the total number of months is known, it would be simple to do in Python. But I suspect that as the number of separate Frequencies commands increases (each of which reads the data), at some point the Split File approach would be faster.


From: Mark Vande Kamp <[hidden email]>
To: [hidden email]
Date: 08/31/2010 11:28 AM
Subject: Frequencies for subgroups
Sent by: "SPSSX(r) Discussion" <[hidden email]>





I am currently using the code below to get frequency outputs for specified subgroups

TEMPORARY.
SELECT IF (Month1stFIC = 1).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 2).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 3).
FREQUENCIES Sessions.

I'd like to make the syntax work for added months without repeating the blocks of code as above.

If I could avoid the SplitFile command (and its required sort) that would be good too -- the sort takes forever because it's a huge file.

Is there another way?

Mark

=====================
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: Frequencies for subgroups

Jon K Peck
In reply to this post by Mark Vande Kamp-2

One possibility would be to use the SPSSINC SPLIT DATASET and SPSSINC PROCESS FILES extension commands.  The first one creates a dataset for each split value, and the second processes each of those datasets.

Sorting is not required for the split: the command does one data pass to determine the distribution of the split values and a second to construct the separate files.  SPSSINC PROCESS FILES can then process each of these datasets in turn using a file list constructed by the first command.  However, disk space will be required to hold the various split datasets, which could be an issue for very large files.  

Using this structure you can get the output from multiple commands together for each split in contrast to what the SPLIT FILES command requires.  There are options to produce a single Viewer file across the datasets or to produce separate files.  I wrote about this on my blog, insideout.spss.com.

These extension commands require the Python programmability plugin and can be downloaded from SPSS Developer Central (www.spss.com/devcentral).

HTH,

Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: Mark Vande Kamp <[hidden email]>
To: [hidden email]
Date: 08/31/2010 10:31 AM
Subject: [SPSSX-L] Frequencies for subgroups
Sent by: "SPSSX(r) Discussion" <[hidden email]>





I am currently using the code below to get frequency outputs for specified subgroups

TEMPORARY.
SELECT IF (Month1stFIC = 1).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 2).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 3).
FREQUENCIES Sessions.

I'd like to make the syntax work for added months without repeating the blocks of code as above.

If I could avoid the SplitFile command (and its required sort) that would be good too -- the sort takes forever because it's a huge file.

Is there another way?

Mark

=====================
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: Frequencies for subgroups

Art Kendall
In reply to this post by Mark Vande Kamp-2
  Sorting is usually one of the most optimized processes under OSs.  Try
setting the memory as large as possible.  Clean up your disk space.
If you really cannot reasonably do a sort, then a workaround would be to
use the /WRITE=CELLS and /FORMAT=NOTABLES specifications in CROSSTABS.
Then, work with the file it creates.

Alternatively, use the /KEEP specification on the GET command to just
keep the 2 variables.

Art Kendall
Social Research Consultants

On 8/31/2010 12:26 PM, Mark Vande Kamp wrote:

> I am currently using the code below to get frequency outputs for specified subgroups
>
> TEMPORARY.
> SELECT IF (Month1stFIC = 1).
> FREQUENCIES Sessions.
> TEMPORARY.
> SELECT IF (Month1stFIC = 2).
> FREQUENCIES Sessions.
> TEMPORARY.
> SELECT IF (Month1stFIC = 3).
> FREQUENCIES Sessions.
>
> I'd like to make the syntax work for added months without repeating the blocks of code as above.
>
> If I could avoid the SplitFile command (and its required sort) that would be good too -- the sort takes forever because it's a huge file.
>
> Is there another way?
>
> Mark
>
> =====================
> 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: Frequencies for subgroups

Albert-Jan Roskam
In reply to this post by Jon K Peck
Hi Jon,

Isn't it very slow to write all those datasets? Or is it faster than sorting and then using SPLIT FILE? Related to this: is it possible to use different sorting algorithms in SPSS (bubble or quick sort, etc)?
 
Btw, so www.spss.com/devcentral will remain a valid link? I was already worried I had to memorize that very long ibm link.
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?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From: Jon K Peck <[hidden email]>
To: [hidden email]
Sent: Tue, August 31, 2010 6:48:53 PM
Subject: Re: [SPSSX-L] Frequencies for subgroups


One possibility would be to use the SPSSINC SPLIT DATASET and SPSSINC PROCESS FILES extension commands.  The first one creates a dataset for each split value, and the second processes each of those datasets.

Sorting is not required for the split: the command does one data pass to determine the distribution of the split values and a second to construct the separate files.  SPSSINC PROCESS FILES can then process each of these datasets in turn using a file list constructed by the first command.  However, disk space will be required to hold the various split datasets, which could be an issue for very large files.  

Using this structure you can get the output from multiple commands together for each split in contrast to what the SPLIT FILES command requires.  There are options to produce a single Viewer file across the datasets or to produce separate files.  I wrote about this on my blog, insideout.spss.com.

These extension commands require the Python programmability plugin and can be downloaded from SPSS Developer Central (www.spss.com/devcentral).

HTH,

Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: Mark Vande Kamp <[hidden email]>
To: [hidden email]
Date: 08/31/2010 10:31 AM
Subject: [SPSSX-L] Frequencies for subgroups
Sent by: "SPSSX(r) Discussion" <[hidden email]>





I am currently using the code below to get frequency outputs for specified subgroups

TEMPORARY.
SELECT IF (Month1stFIC = 1).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 2).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 3).
FREQUENCIES Sessions.

I'd like to make the syntax work for added months without repeating the blocks of code as above.

If I could avoid the SplitFile command (and its required sort) that would be good too -- the sort takes forever because it's a huge file.

Is there another way?

Mark

=====================
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: Frequencies for subgroups

ViAnn Beadle
In reply to this post by Mark Vande Kamp-2
How about using CROSSTABS with MONTH1stFIC as the column variable?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Mark Vande Kamp
Sent: Tuesday, August 31, 2010 10:27 AM
To: [hidden email]
Subject: Frequencies for subgroups

I am currently using the code below to get frequency outputs for specified
subgroups

TEMPORARY.
SELECT IF (Month1stFIC = 1).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 2).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 3).
FREQUENCIES Sessions.

I'd like to make the syntax work for added months without repeating the
blocks of code as above.

If I could avoid the SplitFile command (and its required sort) that would be
good too -- the sort takes forever because it's a huge file.

Is there another way?

Mark

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Frequencies for subgroups

Bruce Weaver
Administrator
ViAnn Beadle wrote
How about using CROSSTABS with MONTH1stFIC as the column variable?
Nah...it's far too simple, and doesn't require Python.  :-|

--
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: Frequencies for subgroups

Spousta Jan
In reply to this post by Mark Vande Kamp-2
Hi Mark,

You can use "CROSSTABS /TABLES=Month1stFIC BY Sessions.", as some colleagues suggested (beware of missing values!), or perhaps even better this (or similar) syntax:

DATASET DECLARE output.
AGGREGATE
  /OUTFILE='output'
  /BREAK=Month1stFIC Sessions
  /N_BREAK=N.

It produces the frequencies in the variable N_BREAK in a new data file.

Best,

Jan

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mark Vande Kamp
Sent: Tuesday, August 31, 2010 6:27 PM
To: [hidden email]
Subject: Frequencies for subgroups

I am currently using the code below to get frequency outputs for specified subgroups

TEMPORARY.
SELECT IF (Month1stFIC = 1).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 2).
FREQUENCIES Sessions.
TEMPORARY.
SELECT IF (Month1stFIC = 3).
FREQUENCIES Sessions.

I'd like to make the syntax work for added months without repeating the blocks of code as above.

If I could avoid the SplitFile command (and its required sort) that would be good too -- the sort takes forever because it's a huge file.

Is there another way?

Mark

=====================
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



_____________
Tato zpráva a všechny připojené soubory jsou důvěrné a určené výlučně adresátovi(-ům). Jestliže nejste oprávněným adresátem, je zakázáno jakékoliv zveřejňování, zprostředkování nebo jiné použití těchto informací. Jestliže jste tento mail dostali neoprávněně, prosím, uvědomte odesilatele a smažte zprávu i přiložené soubory. Odesilatel nezodpovídá za jakékoliv chyby nebo opomenutí způsobené tímto přenosem.

Jste si jisti, že opravdu potřebujete vytisknout tuto zprávu a/nebo její přílohy? Myslete na přírodu.


This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the message as well as all attached documents. The sender does not accept liability for any errors or omissions as a result of the transmission.

Are you sure that you really need a print version of this message and/or its attachments? Think about nature.

-.- --

=====================
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: Frequencies for subgroups

Maguin, Eugene
In reply to this post by Bruce Weaver
Bruce,

What's with the :-| instead of the :-)?

Gene Maguin



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Bruce Weaver
Sent: Tuesday, August 31, 2010 8:18 PM
To: [hidden email]
Subject: Re: Frequencies for subgroups

ViAnn Beadle wrote:
>
> How about using CROSSTABS with MONTH1stFIC as the column variable?
>

Nah...it's far too simple, and doesn't require Python.  :-|



-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Frequencies-for-subgroups-tp27
98317p2798814.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Frequencies for subgroups

John F Hall
I thought the silly season was in August :-))  !!!

John Hall
[hidden email]
http://surveyresearch.weebly.com

----- Original Message -----
From: Gene Maguin
To: [hidden email]
Sent: Wednesday, September 01, 2010 3:03 PM
Subject: Re: Frequencies for subgroups



Bruce,

What's with the :-| instead of the :-)?

Gene Maguin



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Bruce Weaver
Sent: Tuesday, August 31, 2010 8:18 PM
To: [hidden email]
Subject: Re: Frequencies for subgroups

ViAnn Beadle wrote:
>
> How about using CROSSTABS with MONTH1stFIC as the column variable?
>

Nah...it's far too simple, and doesn't require Python.  :-|



-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Frequencies-for-subgroups-tp27
98317p2798814.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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