|
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!
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 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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
--
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/). |
|
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. |
| Free forum by Nabble | Edit this page |
