RonOz asked for a way to automatically adjust the width of the row labels column in a table so that, within limits, the label would not wrap but would be as small as possible. I thought that others might find this functionality useful. I wrote a custom function for SPSSINC MODIFY TABLES that does this. Here is an example using the employee data.sav file shipped with Statistics that adjusts the innermost row label. * make a label long enough to wrap. ADD VALUE LABELS jobcat 1 "a long multiword label that will wrap". CTABLES /TABLE gender > jobcat [COUNT F40.0] BY minority /CATEGORIES VARIABLES=gender ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES POSITION=AFTER /CATEGORIES VARIABLES=jobcat minority ORDER=A KEY=VALUE EMPTY=INCLUDE MISSING=EXCLUDE. SPSSINC MODIFY TABLES subtype="customtable" SELECT=-1 DIMENSION= ROWS PROCESS = PRECEDING /STYLES APPLYTO=LABELS CUSTOMFUNCTION="textsize.setNonwrappingLabelWidth" There are options to specify minimum and maximum widths and the right margin and to override the font and style. Details are in the .py file. MODIFY TABLES can be installed from the Extensions menu. If you want the the textsize.py custom module, send me a direct email, and I will send it to you. |
p.s. I forgot to mention that this sizing custom module only works on Windows as it is necessary to use some Windows-specific functions to calculate the size of the text strings. On Sun, Dec 16, 2018 at 9:15 AM Jon Peck <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |