Modifying Frequency table format - Python?

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

Modifying Frequency table format - Python?

TomSnider
Hello all --

I'd appreciate guidance on something:  I'd like to be able to create an SPSS Frequencies output with certain columns (e.g., Cumulative Frequency) eliminated from all Frequencies tables.

I found a Technote on the IBM site which addresses that very question, but the solution involves installing IBM SPSS Statistics - Essentials for Python, which has a utility to modify tables.  My immediate problem is determining if I already have what I need, or if I need to download something.

When I downloaded SPSS 24, I acquired a number of Python-related apps, but nothing explicitly named "Essentials for Python."  What's listed on my Windows 10 Start Menu, for both Python 2.7 and 3.4, are:
* IDLE (Python GUI)
* Manuals
* Module Docs
* Python Command Line

I feel it's possible that those 4 things ARE the Essentials for Python.  If so, where can I find the utility to modify tables?  Neither the GUI nor the Command Line has an obvious link to the utility.

Or do I need to download something else?  If so, is it freely available on the IBM website or do I need to go back to the vendor where I bought the SPSS Statistics?  Searching the IBM website hasn't been fruitful.

Thanks for any help!
 -- Tom

=====================
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: Modifying Frequency table format - Python?

Jon Peck
The Python Essentials are normally installed with Statistics (since V21 or 22), so you probably have them.

There is no function specifically set up for this, but the SPSSINC MODIFY TABLES extension command can do it.  You need to install this via the Extensions > Extension Hub menu as it is not automatically included in the Essentials since V23 or so, because OUTPUT MODIFY, which was modeled after SPSSINC MODIFY TABLES, is a built-in command that handles the common cases.  

SPSSINC MODIFY TABLES can hide the columns whose labels are listed in SELECT.  PROCESS=ALL  instead of PROCESS=PRECEDING can be used to do this for all the tables of the specified type in the Viewer if you want.

MODIFY TABLES will appear on the Utilities menu as Modify Table Appearance once it is installed, but here is an example of the syntax.
SPSSINC MODIFY TABLES subtype="Frequencies"
SELECT="Cumulative Percent" "Valid Percent" 
DIMENSION= COLUMNS LEVEL = -1  
PROCESS = PRECEDING HIDE=TRUE. 

For the full syntax help, place the cursor on an instance of the command in the Syntax Editor and press F1.



On Thu, Mar 8, 2018 at 3:53 PM, Tom Snider <[hidden email]> wrote:
Hello all --

I'd appreciate guidance on something:  I'd like to be able to create an SPSS Frequencies output with certain columns (e.g., Cumulative Frequency) eliminated from all Frequencies tables.

I found a Technote on the IBM site which addresses that very question, but the solution involves installing IBM SPSS Statistics - Essentials for Python, which has a utility to modify tables.  My immediate problem is determining if I already have what I need, or if I need to download something.

When I downloaded SPSS 24, I acquired a number of Python-related apps, but nothing explicitly named "Essentials for Python."  What's listed on my Windows 10 Start Menu, for both Python 2.7 and 3.4, are:
* IDLE (Python GUI)
* Manuals
* Module Docs
* Python Command Line

I feel it's possible that those 4 things ARE the Essentials for Python.  If so, where can I find the utility to modify tables?  Neither the GUI nor the Command Line has an obvious link to the utility.

Or do I need to download something else?  If so, is it freely available on the IBM website or do I need to go back to the vendor where I bought the SPSS Statistics?  Searching the IBM website hasn't been fruitful.

Thanks for any help!
 -- Tom

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



--
Jon K Peck
[hidden email]

===================== 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: Modifying Frequency table format - Python?

TomSnider
That solved it, Jon.  It works great, and it's fun to watch it work, too!  :-)

Thanks!

On Thu, Mar 8, 2018 at 6:28 PM, Jon Peck <[hidden email]> wrote:
The Python Essentials are normally installed with Statistics (since V21 or 22), so you probably have them.

There is no function specifically set up for this, but the SPSSINC MODIFY TABLES extension command can do it.  You need to install this via the Extensions > Extension Hub menu as it is not automatically included in the Essentials since V23 or so, because OUTPUT MODIFY, which was modeled after SPSSINC MODIFY TABLES, is a built-in command that handles the common cases.  

SPSSINC MODIFY TABLES can hide the columns whose labels are listed in SELECT.  PROCESS=ALL  instead of PROCESS=PRECEDING can be used to do this for all the tables of the specified type in the Viewer if you want.

MODIFY TABLES will appear on the Utilities menu as Modify Table Appearance once it is installed, but here is an example of the syntax.
SPSSINC MODIFY TABLES subtype="Frequencies"
SELECT="Cumulative Percent" "Valid Percent" 
DIMENSION= COLUMNS LEVEL = -1  
PROCESS = PRECEDING HIDE=TRUE. 

For the full syntax help, place the cursor on an instance of the command in the Syntax Editor and press F1.



On Thu, Mar 8, 2018 at 3:53 PM, Tom Snider <[hidden email]> wrote:
Hello all --

I'd appreciate guidance on something:  I'd like to be able to create an SPSS Frequencies output with certain columns (e.g., Cumulative Frequency) eliminated from all Frequencies tables.

I found a Technote on the IBM site which addresses that very question, but the solution involves installing IBM SPSS Statistics - Essentials for Python, which has a utility to modify tables.  My immediate problem is determining if I already have what I need, or if I need to download something.

When I downloaded SPSS 24, I acquired a number of Python-related apps, but nothing explicitly named "Essentials for Python."  What's listed on my Windows 10 Start Menu, for both Python 2.7 and 3.4, are:
* IDLE (Python GUI)
* Manuals
* Module Docs
* Python Command Line

I feel it's possible that those 4 things ARE the Essentials for Python.  If so, where can I find the utility to modify tables?  Neither the GUI nor the Command Line has an obvious link to the utility.

Or do I need to download something else?  If so, is it freely available on the IBM website or do I need to go back to the vendor where I bought the SPSS Statistics?  Searching the IBM website hasn't been fruitful.

Thanks for any help!
 -- Tom

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



--
Jon K Peck
[hidden email]


===================== 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: Modifying Frequency table format - Python?

John F Hall

Yes, JKP's Python runs are always fun to watch.

 

This is possibly now otiose, but for what it's worth, if you only want to do it once or twice, you can modify the Pivot tables and then copy them to Word.  For instance:

 

FREQUENCIES            rearnq.

 

Respondent earnings quartiles (dv)

 

Frequency

Percent

Valid Percent

Cumulative Percent

Valid

Less than £930 p.m.

3554

3.4

23.7

23.7

£931 - 1,600 p.m.

4004

3.8

26.7

50.4

£1,601 - 2,500 p.m.

3856

3.7

25.7

76.1

£2,501 or more p.m.

3576

3.4

23.9

100.0

Total

14990

14.4

100.0

 

Missing

Refused information

493

0.5

 

 

-9

1

0.0

 

 

-8

203

0.2

 

 

-7

1031

1.0

 

 

Not applicable

15823

15.2

 

 

System

71745

68.8

 

 

Total

89296

85.6

 

 

Total

104286

100.0

 

 

(data from British Social Attitudes cumulative file 1983 - 2015)

 

 

Frequency

Percent

Valid Percent

Valid

Less than £930 p.m.

3554

3.4

23.7

£931 - 1,600 p.m.

4004

3.8

26.7

£1,601 - 2,500 p.m.

3856

3.7

25.7

£2,501 or more p.m.

3576

3.4

23.9

Total

14990

14.4

100.0

Missing

Refused information

493

0.5

 

-9

1

0.0

 

-8

203

0.2

 

-7

1031

1.0

 

Not applicable

15823

15.2

 

System

71745

68.8

 

Total

89296

85.6

 

Total

104286

100.0

 

 

If it's something you need to do on a regular basis, CTABLES can produce tables in any format you like.

 

For frequencies try something like:

 

CTABLES /table rearnq.

 

 

 

Count

Respondent earnings quartiles (dv)

Less than £930 p.m.

3554

£931 - 1,600 p.m.

4004

£1,601 - 2,500 p.m.

3856

£2,501 or more p.m.

3576

 

CTABLES

/table rearnq [COLPCT.COUNT TOTALS [COUNT]].

 

 

Column N %

Respondent earnings quartiles (dv)

Less than £930 p.m.

23.7%

£931 - 1,600 p.m.

26.7%

£1,601 - 2,500 p.m.

25.7%

£2,501 or more p.m.

23.9%

 

CTABLES /table rearnq

    [count COLPCT.COUNT TOTALS [COUNT]].

 

 

Count

Column N %

Respondent earnings quartiles (dv)

Less than £930 p.m.

3554

23.7%

£931 - 1,600 p.m.

4004

26.7%

£1,601 - 2,500 p.m.

3856

25.7%

£2,501 or more p.m.

3576

23.9%

 

CTABLES

   /VLABELS VARIABLES= rearnq DISPLAY=NONE

    /table rearnq [colPCT.COUNT f8.1 "%" TOTALS [COUNT f8.0  "n= 100%"]]

    /categories var = rearnq TOTAL =YES POSITION=AFTER.

     [COLPCT.COUNT TOTALS [COUNT]].

 

 

 

%

n= 100%

Less than £930 p.m.

23.7

 

£931 - 1,600 p.m.

26.7

 

£1,601 - 2,500 p.m.

25.7

 

£2,501 or more p.m.

23.9

 

Total

 

14990

 

Check out: http://surveyresearch.weebly.com/uploads/2/9/9/8/2998485/3.2.1.4__elaboration_4__income_differences_2009_%E2%80%93_2014_ctables_.pdf

 

A complex command for a contingency table with row% and base N is :

 

CTABLES /TABLE rsex BY rearnq [ROWPCT.COUNT f5.1 "%" totals [count "n= 100%"]]

/CATEGORIES VARIABLES= sex rearnq TOTAL=YES .

 

 

Respondent earnings quartiles (dv)

Less than £930 p.m.

£931 - 1,600 p.m.

£1,601 - 2,500 p.m.

£2,501 or more p.m.

Total

%

%

%

%

n= 100%

Person 1 SEX

Male

12.3

24.2

30.2

33.2

7235

Female

34.3

29.0

21.5

15.1

7755

Total

23.7

26.7

25.7

23.9

14990

 

Had to play around a bit to get this, but it gets rid of the default clutter in tables.

 

I always work in lower case, but didn't want to upset David Marso in the examples above.

 

 

John F Hall  MA (Cantab) Dip Ed (Dunelm)

[Retired academic survey researcher]

 

Email:          [hidden email]

Website:     Journeys in Survey Research

Course:       Survey Analysis Workshop (SPSS)

Research:   Subjective Social Indicators (Quality of Life)

 

From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Tom Snider
Sent: 09 March 2018 02:56
To: [hidden email]
Subject: Re: Modifying Frequency table format - Python?

 

That solved it, Jon.  It works great, and it's fun to watch it work, too!  :-)

Thanks!

 

On Thu, Mar 8, 2018 at 6:28 PM, Jon Peck <[hidden email]> wrote:

The Python Essentials are normally installed with Statistics (since V21 or 22), so you probably have them.

 

There is no function specifically set up for this, but the SPSSINC MODIFY TABLES extension command can do it.  You need to install this via the Extensions > Extension Hub menu as it is not automatically included in the Essentials since V23 or so, because OUTPUT MODIFY, which was modeled after SPSSINC MODIFY TABLES, is a built-in command that handles the common cases.  

 

SPSSINC MODIFY TABLES can hide the columns whose labels are listed in SELECT.  PROCESS=ALL  instead of PROCESS=PRECEDING can be used to do this for all the tables of the specified type in the Viewer if you want.

 

MODIFY TABLES will appear on the Utilities menu as Modify Table Appearance once it is installed, but here is an example of the syntax.

SPSSINC MODIFY TABLES subtype="Frequencies"

SELECT="Cumulative Percent" "Valid Percent" 

DIMENSION= COLUMNS LEVEL = -1  

PROCESS = PRECEDING HIDE=TRUE. 

 

For the full syntax help, place the cursor on an instance of the command in the Syntax Editor and press F1.

 

 

 

On Thu, Mar 8, 2018 at 3:53 PM, Tom Snider <[hidden email]> wrote:

Hello all --

I'd appreciate guidance on something:  I'd like to be able to create an SPSS Frequencies output with certain columns (e.g., Cumulative Frequency) eliminated from all Frequencies tables.

I found a Technote on the IBM site which addresses that very question, but the solution involves installing IBM SPSS Statistics - Essentials for Python, which has a utility to modify tables.  My immediate problem is determining if I already have what I need, or if I need to download something.

When I downloaded SPSS 24, I acquired a number of Python-related apps, but nothing explicitly named "Essentials for Python."  What's listed on my Windows 10 Start Menu, for both Python 2.7 and 3.4, are:
* IDLE (Python GUI)
* Manuals
* Module Docs
* Python Command Line

I feel it's possible that those 4 things ARE the Essentials for Python.  If so, where can I find the utility to modify tables?  Neither the GUI nor the Command Line has an obvious link to the utility.

Or do I need to download something else?  If so, is it freely available on the IBM website or do I need to go back to the vendor where I bought the SPSS Statistics?  Searching the IBM website hasn't been fruitful.

Thanks for any help!
 -- Tom

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



 

--

Jon K Peck
[hidden email]

 

===================== 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: Modifying Frequency table format - Python?

TomSnider
In reply to this post by TomSnider
John, that's not otiose at all.  I asked the original question for a client who would probably prefer to avoid Python.  Also, it's more elegant to simply create the desired tables directly.  I'm happy to learn both approaches, and the word "otiose" to boot!

=====================
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: Modifying Frequency table format - Python?

Jon Peck
It's true that you can get frequencies from CTABLES as well as the FREQUENCIES command, but there are some differences.
- FREQ will tabulate user and system missing values, but CTABLES never counts system missing
- FREQ gives cumulative statistics, but CTABLES cannot
- CTABLES gives you more control over the particular statistics displayed
- CTABLES can produce subtotals of the frequency statistics
- CTABLES can show empty categories, but FREQ cannot except by playing some sneaky tricks with weighting
- CTABLES gives you control over the order of the values
- CTABLES can handle multiple response data.  FREQ cannot, but MULT RESPONSE can also do these, although mr set definition is a pain in that procedure.

On Sat, Mar 10, 2018 at 9:29 AM, Tom Snider <[hidden email]> wrote:
John, that's not otiose at all.  I asked the original question for a client who would probably prefer to avoid Python.  Also, it's more elegant to simply create the desired tables directly.  I'm happy to learn both approaches, and the word "otiose" to boot!

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



--
Jon K Peck
[hidden email]

===================== 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: Modifying Frequency table format - Python?

TomSnider
I was playing with CTABLES today, and it appears that it requires a separate command for each variable to be displayed.  The task that prompted my question was creating simplified tables to display the responses to 80 items in a test.  As I understood the documentation, this would require 80 separate CTABLES commands, whereas the Frequencies + Python combo could do it with one FREQUENCIES command and one Python command.

On Sat, Mar 10, 2018 at 6:28 PM, Jon Peck <[hidden email]> wrote:
It's true that you can get frequencies from CTABLES as well as the FREQUENCIES command, but there are some differences.
- FREQ will tabulate user and system missing values, but CTABLES never counts system missing
- FREQ gives cumulative statistics, but CTABLES cannot
- CTABLES gives you more control over the particular statistics displayed
- CTABLES can produce subtotals of the frequency statistics
- CTABLES can show empty categories, but FREQ cannot except by playing some sneaky tricks with weighting
- CTABLES gives you control over the order of the values
- CTABLES can handle multiple response data.  FREQ cannot, but MULT RESPONSE can also do these, although mr set definition is a pain in that procedure.

On Sat, Mar 10, 2018 at 9:29 AM, Tom Snider <[hidden email]> wrote:
John, that's not otiose at all.  I asked the original question for a client who would probably prefer to avoid Python.  Also, it's more elegant to simply create the desired tables directly.  I'm happy to learn both approaches, and the word "otiose" to boot!

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



--
Jon K Peck
[hidden email]


===================== 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: Modifying Frequency table format - Python?

Jon Peck
You can have multiple TABLE subcommands in one CTABLES command if you want separate tables
​, but you would still need one subcommand per variable.​

You could rig up a macro to iterate
​a CTABLES command ​
over a list of variables
​ using​
​ the macro list processing loop !do !index !in..., but how to construct the list, since "TO" would be unavailable​?
  
​Instead of writing out all the names, ​
​you could use the SPSSINC SELECT VARIABLES extension command to construct the list.  That command also allows you to build a list based on metadata such as patterns in names, variable type, and variable measurement level.  For example,
SPSSINC SELECT VARIABLES MACRONAME="!somevars" VARIABLES=a TO b /PROPERTIES NOMINAL ORDINAL.
would construct a macro named !somevars listing all variables between a and b that are categorical.

Then, something like this (add any other static specifications):

define !mac (!pos !charend('/'))
!do !i !in (!1)
ctables /table !i.
!doend
!enddefine.


Just don't tell the client that SPSSINC SELECT VARIABLES is implemented in -- Python.​


On Sat, Mar 10, 2018 at 6:37 PM Tom Snider <[hidden email]> wrote:
I was playing with CTABLES today, and it appears that it requires a separate command for each variable to be displayed.  The task that prompted my question was creating simplified tables to display the responses to 80 items in a test.  As I understood the documentation, this would require 80 separate CTABLES commands, whereas the Frequencies + Python combo could do it with one FREQUENCIES command and one Python command.

On Sat, Mar 10, 2018 at 6:28 PM, Jon Peck <[hidden email]> wrote:
It's true that you can get frequencies from CTABLES as well as the FREQUENCIES command, but there are some differences.
- FREQ will tabulate user and system missing values, but CTABLES never counts system missing
- FREQ gives cumulative statistics, but CTABLES cannot
- CTABLES gives you more control over the particular statistics displayed
- CTABLES can produce subtotals of the frequency statistics
- CTABLES can show empty categories, but FREQ cannot except by playing some sneaky tricks with weighting
- CTABLES gives you control over the order of the values
- CTABLES can handle multiple response data.  FREQ cannot, but MULT RESPONSE can also do these, although mr set definition is a pain in that procedure.

On Sat, Mar 10, 2018 at 9:29 AM, Tom Snider <[hidden email]> wrote:
John, that's not otiose at all.  I asked the original question for a client who would probably prefer to avoid Python.  Also, it's more elegant to simply create the desired tables directly.  I'm happy to learn both approaches, and the word "otiose" to boot!

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



--
Jon K Peck
[hidden email]


===================== 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: Modifying Frequency table format - Python?

John F Hall

Nice one Jon!  I also was wondering if a macro would do it: must try it.

 

 

John F Hall  MA (Cantab) Dip Ed (Dunelm)

[Retired academic survey researcher]

 

Email:          [hidden email]

Website:     Journeys in Survey Research

Course:       Survey Analysis Workshop (SPSS)

Research:   Subjective Social Indicators (Quality of Life)

 

From: SPSSX(r) Discussion <[hidden email]> On Behalf Of Jon Peck
Sent: 11 March 2018 03:39
To: [hidden email]
Subject: Re: Modifying Frequency table format - Python?

 

You can have multiple TABLE subcommands in one CTABLES command if you want separate tables

​, but you would still need one subcommand per variable.​

 

You could rig up a macro to iterate

​a CTABLES command ​

over a list of variables

​ using​

​ the macro list processing loop !do !index !in..., but how to construct the list, since "TO" would be unavailable​?

  

​Instead of writing out all the names, ​

​you could use the SPSSINC SELECT VARIABLES extension command to construct the list.  That command also allows you to build a list based on metadata such as patterns in names, variable type, and variable measurement level.  For example,

SPSSINC SELECT VARIABLES MACRONAME="!somevars" VARIABLES=a TO b /PROPERTIES NOMINAL ORDINAL.

would construct a macro named !somevars listing all variables between a and b that are categorical.

 

Then, something like this (add any other static specifications):

 

define !mac (!pos !charend('/'))

!do !i !in (!1)

ctables /table !i.

!doend

!enddefine.

 

 

Just don't tell the client that SPSSINC SELECT VARIABLES is implemented in -- Python.​

 

 

On Sat, Mar 10, 2018 at 6:37 PM Tom Snider <[hidden email]> wrote:

I was playing with CTABLES today, and it appears that it requires a separate command for each variable to be displayed.  The task that prompted my question was creating simplified tables to display the responses to 80 items in a test.  As I understood the documentation, this would require 80 separate CTABLES commands, whereas the Frequencies + Python combo could do it with one FREQUENCIES command and one Python command.

 

On Sat, Mar 10, 2018 at 6:28 PM, Jon Peck <[hidden email]> wrote:

It's true that you can get frequencies from CTABLES as well as the FREQUENCIES command, but there are some differences.

- FREQ will tabulate user and system missing values, but CTABLES never counts system missing

- FREQ gives cumulative statistics, but CTABLES cannot

- CTABLES gives you more control over the particular statistics displayed

- CTABLES can produce subtotals of the frequency statistics

- CTABLES can show empty categories, but FREQ cannot except by playing some sneaky tricks with weighting

- CTABLES gives you control over the order of the values

- CTABLES can handle multiple response data.  FREQ cannot, but MULT RESPONSE can also do these, although mr set definition is a pain in that procedure.

 

On Sat, Mar 10, 2018 at 9:29 AM, Tom Snider <[hidden email]> wrote:

John, that's not otiose at all.  I asked the original question for a client who would probably prefer to avoid Python.  Also, it's more elegant to simply create the desired tables directly.  I'm happy to learn both approaches, and the word "otiose" to boot!

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



 

--

Jon K Peck
[hidden email]

 

===================== 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: Modifying Frequency table format - Python?

Art Kendall
In reply to this post by Jon Peck
My memory is not what it used to be and I do not have access to SPSS at the
moment BUT

Isn't there a tables procedure in the GUI that puts a set of values in one
dimension (e.g., horizontal) and test items in the other?

I am assuming that since these are summative test items that have the same
response format.





-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Modifying Frequency table format - Python?

Jon Peck
If the categories are the same for all the variables and the number of categories isn't too large, you can create a comperimeter table with the variables in the rows and the categories in the columns with a command like
ctables
/table (a+b+...)[count rowpct.count]
/clabels rowlabels=opposite.

This would, of course, not make sense if the categories differ by variable or there are too many to display reasonably across the columns.

In this case, SPSSINC SELECT VARIABLES could be used to construct the a+b+... part by specifying + as the separator character.

Still another variation on the macro I posted recently, which runs a separate CTABLES command for each variable and thus requires many data passes would be to have the macro generate many TABLE subcommands within a single CTABLES command like this.

define !mac (!pos !charend('/'))
ctables 
!do !i !in (!1) /table !i
!doend
!enddefine.

!mac !somevars.

On Sun, Mar 11, 2018 at 7:46 AM, Art Kendall <[hidden email]> wrote:
My memory is not what it used to be and I do not have access to SPSS at the
moment BUT

Isn't there a tables procedure in the GUI that puts a set of values in one
dimension (e.g., horizontal) and test items in the other?

I am assuming that since these are summative test items that have the same
response format.





-----
Art Kendall
Social Research Consultants
--
Sent from: http://spssx-discussion.1045642.n5.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



--
Jon K Peck
[hidden email]

===================== 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: Modifying Frequency table format - Python?

John F Hall
In reply to this post by TomSnider

I modified Jon's syntax to test on some of my data:

 

SPSSINC SELECT VARIABLES  MACRONAME="!somevars"

VARIABLES=NHSSat to CareSat3.

 

 

Variables Listed in Macro !somevars

AESat CareSat3 DentSat GPSat InpatSat NHSSat OutpaSat

 

define !mac (!pos !charend('/'))

!do !i !in (!1)

ctables /table !i.

!doend

!enddefine.

Processor is ready, but how do I get the tables?.

 

John F Hall  MA (Cantab) Dip Ed (Dunelm)

[Retired academic survey researcher]

 

Email:          [hidden email]

Website:     Journeys in Survey Research

Course:       Survey Analysis Workshop (SPSS)

Research:   Subjective Social Indicators (Quality of Life)

 

===================== 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: Modifying Frequency table format - Python?

David Marso
Administrator
The macro !mac is expecting a list of variables.
One such list is available in !somevars.

!mac !somevars.

would do the trick.

!mac AESat CareSat3 DentSat GPSat InpatSat NHSSat OutpaSat.

would be another way.

I usually try to give my macros a bit more descriptive name.
HTH



John F Hall wrote

> I modified Jon's syntax to test on some of my data:
>
>  
>
> SPSSINC SELECT VARIABLES  MACRONAME="!somevars"
>
> VARIABLES=NHSSat to CareSat3.
>
>  
>
>  
>
>
> Variables Listed in Macro !somevars
>
>
> AESat CareSat3 DentSat GPSat InpatSat NHSSat OutpaSat
>
>  
>
> define !mac (!pos !charend('/'))
>
> !do !i !in (!1)
>
> ctables /table !i.
>
> !doend
>
> !enddefine.
>
> Processor is ready, but how do I get the tables?.
>
>  
>
> John F Hall  MA (Cantab) Dip Ed (Dunelm)
>
> [Retired academic survey researcher]
>
>  
>
> Email:          

> johnfhall@

>  &lt;mailto:

> johnfhall@

> &gt;  
>
> Website:     Journeys in Survey Research
> &lt;http://surveyresearch.weebly.com/&gt;
>
>
> Course:       Survey Analysis Workshop (SPSS)
> &lt;http://surveyresearch.weebly.com/1-survey-analysis-workshop-spss.html&gt; 
>
> Research:   Subjective Social Indicators (Quality of Life)
> &lt;http://surveyresearch.weebly.com/3-subjective-social-indicators-quality-of-
> life.html&gt;
>
>  
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





-----
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?"
--
Sent from: http://spssx-discussion.1045642.n5.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
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?"