|
Any help appreciated.
I am simply trying to create macro associated with custom table code in which I can simply change the year as the annual source data changes and the year is inserted into the table's title. I am not well versed with macros but I am thinking my use of the !cmdend is the bigger problem. Thanks, JF define !CTable(year=!cmdend). 2009 !enddefine. define CTable (). * Custom Tables. CTABLES /VLABELS VARIABLES=state sex Missing_N DISPLAY=LABEL /TABLE state [C] BY sex [C][ROWPCT.COUNT '' PCT40.1, TOTALS[COUNT '' COMMA40.0]] + Missing_N [S][SUM '' COMMA40.0] /CATEGORIES VARIABLES=state [1, 2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 56, 72] EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER /CATEGORIES VARIABLES=sex [1, 2] EMPTY=EXCLUDE TOTAL=YES LABEL='Total N' POSITION=AFTER /TITLES TITLE=!QUOTE(!CONCAT('Gender Of Children Adopted: October 1, 2008 to September 30',' !Year')). !enddefine. !CTable. ===================== 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 |
|
Administrator
|
This is a case where you should parameterize the main table macro and scrap the crap at the top.
I suspect if you peruse the section on DEFINE !ENDDEFINE in the FM you will be able to sort your stuff. DEFINE CTable (!POSITIONAL !TOKENS(1) ). blah blah blah maybe a space after 30??...-......October 1, 2008 to September 30 ',' !1)). It helps to use SET MPRINT ON when debugging macros! HTH
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?" |
|
Look at the macro names and add an !eval.
There are other improvements that could be made but his version works. Keeping the date separate, i.e., global, might be a good approach if it will be used in several places. define !CTable(year=!cmdend). 2009 !enddefine. define !CTablex (). * Custom Tables. CTABLES /TABLE jobcat /TITLES TITLE=!QUOTE(!CONCAT('Gender Of Children Adopted: October 1, 2008 to September 30', !eval(!Ctable))). !enddefine. !CTablex. This would, of course, be simpler if you used programmability instead of macro. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: David Marso <[hidden email]> To: [hidden email] Date: 08/31/2015 01:53 PM Subject: Re: [SPSSX-L] Custom Table Macro For Table Title Sent by: "SPSSX(r) Discussion" <[hidden email]> This is a case where you should parameterize the main table macro and scrap the crap at the top. I suspect if you peruse the section on DEFINE !ENDDEFINE in the FM you will be able to sort your stuff. DEFINE CTable (!POSITIONAL !TOKENS(1) ). blah blah blah maybe a space after 30??...-......October 1, 2008 to September 30 ',' !1)). It helps to use SET MPRINT ON when debugging macros! HTH SUBSCRIBE SPSSX-JohnF wrote > Any help appreciated. > > I am simply trying to create macro associated with custom table code in > which I can simply change the year as the annual source data changes and > the year is inserted into the table's title. I am not well versed with > macros but I am thinking my use of the !cmdend is the bigger problem. > > Thanks, > JF > > > define !CTable(year=!cmdend). > 2009 > !enddefine. > > > define CTable (). > * Custom Tables. > CTABLES > /VLABELS VARIABLES=state sex Missing_N DISPLAY=LABEL > /TABLE state [C] BY sex [C][ROWPCT.COUNT '' PCT40.1, TOTALS[COUNT '' > COMMA40.0]] + Missing_N > [S][SUM '' COMMA40.0] > /CATEGORIES VARIABLES=state [1, 2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, > 16, 17, 18, 19, 20, 21, 22, > 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, > 40, 41, 42, 44, 45, 46, 47, 48, > 49, 50, 51, 53, 54, 55, 56, 72] EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER > /CATEGORIES VARIABLES=sex [1, 2] EMPTY=EXCLUDE TOTAL=YES LABEL='Total N' > POSITION=AFTER > /TITLES > TITLE=!QUOTE(!CONCAT('Gender Of Children Adopted: October 1, 2008 to > September 30',' !Year')). > !enddefine. > > !CTable. > > ===================== > 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?" -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Custom-Table-Macro-For-Table-Title-tp5730554p5730556.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 |
|
(Now with 'reply all')
=====================
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
From: [hidden email] To: [hidden email] Subject: RE: [SPSSX-L] Custom Table Macro For Table Title Date: Mon, 31 Aug 2015 22:48:20 +0000 I would simply do:
Define @year () "2015" !enddefine. And then: Ctables ... /titles title ="Analysis of year " + @year. The @ sign is special in the context of the Production Facility (stats.com). In this case, you can parametrize the syntax with the '-symbols' option, but then you need to remove the 'define' because Spss will generate one. From the top of my head: Stats.com -production silent -nologo -symbols @year "2015" -unicode on myjob.spj Albert-Jan Date: Mon, 31 Aug 2015 14:09:34 -0600 From: [hidden email] Subject: Re: [SPSSX-L] Custom Table Macro For Table Title To: [hidden email] Look at the macro names and add an !eval. There are other improvements that could be made but his version works. Keeping the date separate, i.e., global, might be a good approach if it will be used in several places. define !CTable(year=!cmdend). 2009 !enddefine. define !CTablex (). * Custom Tables. CTABLES /TABLE jobcat /TITLES TITLE=!QUOTE(!CONCAT('Gender Of Children Adopted: October 1, 2008 to September 30', !eval(!Ctable))). !enddefine. !CTablex. This would, of course, be simpler if you used programmability instead of macro. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: David Marso <[hidden email]> To: [hidden email] Date: 08/31/2015 01:53 PM Subject: Re: [SPSSX-L] Custom Table Macro For Table Title Sent by: "SPSSX(r) Discussion" <[hidden email]> This is a case where you should parameterize the main table macro and scrap the crap at the top. I suspect if you peruse the section on DEFINE !ENDDEFINE in the FM you will be able to sort your stuff. DEFINE CTable (!POSITIONAL !TOKENS(1) ). blah blah blah maybe a space after 30??...-......October 1, 2008 to September 30 ',' !1)). It helps to use SET MPRINT ON when debugging macros! HTH SUBSCRIBE SPSSX-JohnF wrote > Any help appreciated. > > I am simply trying to create macro associated with custom table code in > which I can simply change the year as the annual source data changes and > the year is inserted into the table's title. I am not well versed with > macros but I am thinking my use of the !cmdend is the bigger problem. > > Thanks, > JF > > > define !CTable(year=!cmdend). > 2009 > !enddefine. > > > define CTable (). > * Custom Tables. > CTABLES > /VLABELS VARIABLES=state sex Missing_N DISPLAY=LABEL > /TABLE state [C] BY sex [C][ROWPCT.COUNT '' PCT40.1, TOTALS[COUNT '' > COMMA40.0]] + Missing_N > [S][SUM '' COMMA40.0] > /CATEGORIES VARIABLES=state [1, 2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, > 16, 17, 18, 19, 20, 21, 22, > 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, > 40, 41, 42, 44, 45, 46, 47, 48, > 49, 50, 51, 53, 54, 55, 56, 72] EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER > /CATEGORIES VARIABLES=sex [1, 2] EMPTY=EXCLUDE TOTAL=YES LABEL='Total N' > POSITION=AFTER > /TITLES > TITLE=!QUOTE(!CONCAT('Gender Of Children Adopted: October 1, 2008 to > September 30',' !Year')). > !enddefine. > > !CTable. > > ===================== > 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?" -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Custom-Table-Macro-For-Table-Title-tp5730554p5730556.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 LISTSERV@... (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 |
| Free forum by Nabble | Edit this page |
