Making SPSS better

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

Re: Making SPSS better

John F Hall

Bruce

 

Thanks for the syntax you sent for CROSSBREAK: it will come in handy to replicate some of my older tutorials.  I modified your syntax to define a new macro ELABORATE.  This works in percentages and puts the dependent variable Y in the columns.

 

* Encoding: UTF-8.

DEFINE elaborate

( Y = !CHAREND('/') /

   RowVar = !CHAREND('/') /

   ColVar = !CMDEND ).

 

CTABLES

  /TABLE !RowVar  [C] >  !ColVar [C] by !Y [c][ROWPCT.totaln, COUNT]

  /SLABELS POSITION=ROW VISIBLE=NO

  /CATEGORIES VARIABLES= !y  TOTAL=YES

  /TITLES CAPTION ='NOTE:  Cells show ROWPCT and COUNT'.

!ENDDEFINE.

 

* Read in some data to illustrate.

* Modify path on the FILE HANDLE command as needed.

FILE HANDLE TheDataFile /NAME='C:\Users\John\Desktop\bsa_elab2.sav'.

NEW FILE.

DATASET CLOSE all.

GET FILE = "TheDataFile".

 

* Call the macro.

elaborate Y = earngrp / RowVar = rsex / ColVar = workmode.

 

Bingo!

 

 

earngrp Quartile group of R's earnings from paid work

1 Q1

2 Q2

3 Q3

4 Q4

Total

Rsex Person 1 SEX

1 Male

workmode R working full- or part-time

1 Full time

5.5%

24.3%

29.3%

31.6%

100.0%

185

810

977

1056

3028

2 Part time

39.0%

20.8%

13.5%

13.3%

100.0%

187

100

65

64

416

2 Female

workmode R working full- or part-time

1 Full time

14.6%

30.7%

27.2%

18.3%

100.0%

390

823

728

490

2431

2 Part time

55.4%

20.8%

8.0%

3.6%

100.0%

998

375

145

65

1583

NOTE:  Cells show ROWPCT and COUNT

 

This is a useful shot at first order tables: I’ll play with refinements to edit/reformat the output to get rid of superfluous clutter.  Do I have to run the macro every time, or can I store it as a named procedure and just use the ELABORATE command?

 

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

 

 

 

 

===================== 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: Making SPSS better

Bruce Weaver
Administrator
John, you need to run the macro definition syntax only once per SPSS session.  If you will be using your ELABORATE macro frequently, you can have the macro definition syntax run automatically at startup.  This was discussed a few years ago (see link below).  I don't know if any of the details have changed since then.

http://spssx-discussion.1045642.n5.nabble.com/Running-a-Syntax-File-at-the-start-of-each-SPSS-session-amp-Formatting-Wrap-text-in-syntax-editor-td3232350.html



John F Hall wrote
--- snip ---
 
This is a useful shot at first order tables: I’ll play with refinements to edit/reformat the output to get rid of superfluous clutter.  Do I have to run the macro every time, or can I store it as a named procedure and just use the ELABORATE command?
 
 
John F Hall (Mr)
[Retired academic survey researcher]
--
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: Making SPSS better

Jon Peck
Taking this one step further, the STATS OPEN PROJECT extension command can be used to set up an environment for your project.  It can run syntax, open files, set paths, etc.  Projects can reference other projects, so you could have a global configuration and on top of that project-specific settings.  The command can create a startup script so that a project environment can be created automatically whenever Statistics starts.

On Mon, Jul 25, 2016 at 5:38 AM, Bruce Weaver <[hidden email]> wrote:
John, you need to run the macro definition syntax only once per SPSS session.
If you will be using your ELABORATE macro frequently, you can have the macro
definition syntax run automatically at startup.  This was discussed a few
years ago (see link below).  I don't know if any of the details have changed
since then.

http://spssx-discussion.1045642.n5.nabble.com/Running-a-Syntax-File-at-the-start-of-each-SPSS-session-amp-Formatting-Wrap-text-in-syntax-editor-td3232350.html




John F Hall wrote
> --- snip ---
>
> This is a useful shot at first order tables: I’ll play with refinements to
> edit/reformat the output to get rid of superfluous clutter.  Do I have to
> run the macro every time, or can I store it as a named procedure and just
> use the ELABORATE command?
>
>
> John F Hall (Mr)
> [Retired academic survey researcher]





-----
--
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/Making-SPSS-better-tp5732642p5732819.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



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