Bruce I’ve been trying to modify the elaboration macro: A straightforward CTABLES works: ctables /TABLE ExPrtFul > rsex BY rearnq [ROWPCT.COUNT f5.1 "%" totals [count "n= 100%"]] /CATEGORIES VARIABLES= rearnq TOTAL=YES .
. . but my modified macro doesn’t and I keep getting error messages. Error # 1. Command name: close The first word in the line is not recognized as an SPSS Statistics command. Execution of this command stops. get file thedatafile. Error # 61 in column 10. Text: thedatafile The filename is not valid. Execution of this command stops. Error # 105. Command name: CTABLES This command is not valid before a working file has been defined. Execution of this command stops. What am I doing wrong? My shot at the macro is: * Encoding: UTF-8. *Elaboration 2. DEFINE elaborate ( Y = !CHAREND('/') / RowVar = !CHAREND('/') / ColVar = !CMDEND ) CTABLES /TABLE !RowVar [C] > !ColVar [C] by !Y [c] [ROWPCT.COUNT f5.1 "%" ] totals [count "n= 100%"]] /SLABELS POSITION=ROW VISIBLE=NO /CATEGORIES VARIABLES= !y TOTAL=YES /TITLES CAPTION ='NOTE: Cells show ROWPCT and Row 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\gss_2016\babbie2019.sav'. NEW FILE. * Call the macro. elaborate Y = abany / RowVar = postlife / ColVar = vote12. DATASET ACTIVATE DataSet4. GET FILE='H:\F drive backup\Research1a\4 Surveys\British Social Attitudes\2018\bsa2018a.sav'. DATASET NAME DataSet5 WINDOW=FRONT. GET FILE='H:\F drive backup\Research1a\4 Surveys\British Social Attitudes\2018\bsa2018_final_ukda.sav'. Warning # 5281. Command name: GET FILE SPSS Statistics is running in Unicode encoding mode. This file is encoded in a locale-specific (code page) encoding. The defined width of any string variables are automatically tripled in order to avoid possible data loss. You can use ALTER TYPE to set the width of string variables to the width of the longest observed value for each string variable. DATASET NAME DataSet6 WINDOW=FRONT. DATASET ACTIVATE DataSet4. DEFINE elaborate ( Y = !CHAREND('/') / RowVar = !CHAREND('/') / ColVar = !CMDEND ) CTABLES /TABLE !RowVar [C] > !ColVar [C] by !Y [c] [ROWPCT.COUNT f5.1 "%" ] totals [count "n= 100%"]] /SLABELS POSITION=ROW VISIBLE=NO /CATEGORIES VARIABLES= !y TOTAL=YES /TITLES CAPTION ='NOTE: Cells show ROWPCT and Row 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\gss_2016\babbie2019jfh.sav'. new file. close all. Error # 1. Command name: close The first word in the line is not recognized as an SPSS Statistics command. Execution of this command stops. get file thedatafile. Error # 61 in column 10. Text: thedatafile The filename is not valid. Execution of this command stops. * Call the macro. elaborate Y = abany / RowVar = postlife / ColVar = vote12. Error # 105. Command name: CTABLES This command is not valid before a working file has been defined. Execution of this command stops. DATASET ACTIVATE DataSet4. FILE HANDLE TheDataFile /NAME='C:\Users\John\Desktop\gss_2016\babbie2019jfh.sav'. new file. dataset close all. get file thedatafile. Error # 61 in column 10. Text: thedatafile The filename is not valid. Execution of this command stops. * Call the macro. elaborate Y = abany / RowVar = postlife / ColVar = vote12. Error # 105. Command name: CTABLES This command is not valid before a working file has been defined. Execution of this command stops. GET FILE='H:\F drive backup\Research1a\4 Surveys\British Social Attitudes\2018\bsa2018b.sav'. DATASET NAME DataSet7 WINDOW=FRONT. FILE HANDLE TheDataFile /NAME='C:\Users\John\Desktop\gss_2016\bsa2018b.sav'. new file. dataset close all. get file 'thedatafile'. Error # 61 in column 10. Text: thedatafile The filename is not valid. Execution of this command stops. elaborate Y = abany / RowVar = postlife / ColVar = vote12. Error # 105. Command name: CTABLES This command is not valid before a working file has been defined. Execution of this command stops. FILE HANDLE TheDataFile /NAME='C:\Users\John\Desktop\gss_2016\bsa2018b.sav'. NEW FILE. DATASET CLOSE all. GET FILE = "TheDataFile". Error # 61 in column 12. Text: TheDataFile The filename is not valid. Execution of this command stops. GET FILE = TheDataFile. Error # 61 in column 12. Text: TheDataFile The filename is not valid. Execution of this command stops. * Read in some data to illustrate. * Modify path on the FILE HANDLE command as needed. FILE HANDLE TheDataFile /NAME='C:\Users\John\Desktop\gss_2016\babbie2019.sav'. NEW FILE. * Call the macro. elaborate Y = abany / RowVar = postlife / ColVar = vote12. Error # 105. Command name: CTABLES This command is not valid before a working file has been defined. Execution of this command stops. GET FILE='C:\Users\JohnPC\Desktop\GSS_2016\babbie2019jfh.sav'. DATASET NAME DataSet8 WINDOW=FRONT. John F Hall MA (Cantab) Dip Ed (Dunelm) IBM-SPSS Academic Author 9900074 Email: [hidden email] Website: Journeys in Survey Research Course: Survey Analysis Workshop (SPSS) |
Administrator
|
John, where you wrote:
new file. close all. ...change it to: new file. DATASET close all. John F Hall wrote > Bruce > I've been trying to modify the elaboration macro: > > --- snip --- ----- -- 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. -- 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
--
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/). |
Free forum by Nabble | Edit this page |