I need to widen most tables in my output, but not all. So, first, I widen all
tables with this syntax... *Widen the row label column width for all tables. SPSSINC MODIFY TABLES subtype="Custom Table" SELECT=0 DIMENSION= COLUMNS LEVEL = -1 SIGLEVELS=BOTH PROCESS = ALL /WIDTHS WIDTHS=50 ROWLABELS=1 ROWLABELWIDTHS=300 /STYLES APPLYTO=DATACELLS. ...and then I was trying to narrow specific tables (tried to identify by the title), but it narrowed all tables... *Narrow the row label column width for select tables (it narrows, but for all tables). SPSSINC MODIFY TABLES subtype="Custom Table" SELECT="Demographic Comparison of Survey Respondents to Non-Respondents" DIMENSION= COLUMNS LEVEL = -1 SIGLEVELS=BOTH PROCESS = ALL /WIDTHS WIDTHS=50 ROWLABELS=1 ROWLABELWIDTHS=100 /STYLES APPLYTO=DATACELLS. ...any ideas? -- 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 |
You would have to use PROCESS = PRECEDING instead of ALL and put MODIFY TABLES right after the command that generated them. On Thu, Aug 20, 2020 at 3:40 PM ChrisKeran <[hidden email]> wrote: I need to widen most tables in my output, but not all. So, first, I widen all |
Thanks, Jon. I know about that option, however, I have a ton of tables (say
80) that need to be widened and only about 12 needing to be left alone (or narrowed). Using Process=Preceding, I'd have to have the SPSSINC Modify Tables after each table. Kind of ugly. -- 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 |
I had two thoughts about how to handle this. First, CTABLES allows you to set MINCOLWIDTH and MAXCOLWIDTH on the FORMAT subcommand. Would that be sufficient to eliminate the need for resizing? If not, MODIFY TABLES could be used with a tiny custom function to stop it operating on tables that should be left alone. For example, this one stops almost all operations. def maybe(obj, i, j, numrows, numcols, section, more): return False So if the conditions under which the table should be left alone can be evaluated in the custom function, you could use PROCESS=ALL to apply the formatting/resizing only to those tables. However, the custom function is called after other actions are applied, so it might have to undo the first action. Since this would operate on all the tables, it might be a bit slow, but it would be a lot faster than doing it by hand. On Thu, Aug 20, 2020 at 4:35 PM ChrisKeran <[hidden email]> wrote: Thanks, Jon. I know about that option, however, I have a ton of tables (say |
That's awesome, Jon. I really like your custom function idea, because all of
the tables which should be left alone have more data columns (numcols>2) than the ones to be left alone (numcols=2). How do I implement this? -- 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 |
Sorry, I "misspoke." This is what I meant...
That's awesome, Jon. I really like your custom function idea, because all of the tables which should be left alone have more data columns (numcols>2) than the ones to be adjusted (numcols=2). How do I implement this? -- 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 |
Send me an spv file that needs to be processed and the two MODIFY TABLES commands you are using, and I'll see what I can do. On Fri, Aug 21, 2020 at 5:51 AM ChrisKeran <[hidden email]> wrote: Sorry, I "misspoke." This is what I meant... |
Well, once again, Jon Peck to the rescue. I needed to resize the width of
tables based on the number of data columns each table had: a) 2 or b) more than 2 data columns. Jon provided the syntax below as well as these instructions (which, of course worked fantastic)... "Try the attached file out. It does all the resizing in the custom function resize, which is called for all the Custom Table objects via MODIFY TABLES. The function has four parameters with obvious names. You can experiment with the row label and data cell widths conditional on <=2 or > 2 columns." *JKP 8/21/2020. begin program. def resize(obj, i, j, numrows, numcols, section, more, custom): """resize row labels and data columns parameters: rlwidthLE2 -row label width for tables with <= 2 columns rlwidthGT2 -row label width for tables with > 2 columns dcwidthLE2 - column width for tables with <= 2 columns dcwidthGT2 - column width for tables with > 2 columns""" rowlabelarray = more.thetable.RowLabelArray() if numcols <= 2: rowlabelarray.SetRowLabelWidthAt(1, 1, custom.get("rlwidthLE2")) more.thetable.SetDataCellWidths(custom.get("dcwidthLE2")) else: rowlabelarray.SetRowLabelWidthAt(1, 1, custom.get("rlwidthGT2")) more.thetable.SetDataCellWidths(custom.get("dcwidthGT2")) return False end program. SPSSINC MODIFY TABLES subtype="Custom Table" SELECT=0 PROCESS = ALL /STYLES CUSTOMFUNCTION="__main__.resize(rlwidthLE2=300, rlwidthGT2=100, dcwidthLE2=50, dcwidthGT2=50)". Thanks again, Jon. Chris -- 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 |
Free forum by Nabble | Edit this page |