Hi,
is there a way to do a linebreak for a long custom LABEL name for a sas data set variable?
Thanks
That is what the SPLIT= option on PROC PRINT is designed for.
SPLIT='split-character'
specifies the split character, which controls line breaks in column headings. It also uses labels as column headings. PROC PRINT breaks a column heading when it reaches the split character and continues the header on the next line. The split character is not part of the column heading although each occurrence of the split character counts toward the 256-character maximum for a label.
Alias: | S= |
Interaction: | You do not need to use both LABEL and SPLIT= because SPLIT= implies the use of labels. |
Interaction: | The OBS= option honors the split character. (See the discussion of OBS=.) |
Featured in: | Customizing Text in Column Headings |
Note: PROC PRINT does not split labels of BY variables in the heading preceding each BY group even if you specify SPLIT=. Instead, PROC PRINT replaces the split character with a blank.
Where to expect to see the linebreak take effect? SAS output such as proc contents, the explorer window or elsewhere?
That is what the SPLIT= option on PROC PRINT is designed for.
SPLIT='split-character'
specifies the split character, which controls line breaks in column headings. It also uses labels as column headings. PROC PRINT breaks a column heading when it reaches the split character and continues the header on the next line. The split character is not part of the column heading although each occurrence of the split character counts toward the 256-character maximum for a label.
Alias: | S= |
Interaction: | You do not need to use both LABEL and SPLIT= because SPLIT= implies the use of labels. |
Interaction: | The OBS= option honors the split character. (See the discussion of OBS=.) |
Featured in: | Customizing Text in Column Headings |
Note: PROC PRINT does not split labels of BY variables in the heading preceding each BY group even if you specify SPLIT=. Instead, PROC PRINT replaces the split character with a blank.
Awesome! Thats what I needed!
Another possibility, which is useful only if you are sending ODS output to HTML, is to add a soft hyphen character. This causes the browser dynamically to break the word at the hyphen if the available space is narrow, in the same way as it does with a space.
Example:
%let HY=^{unicode 00AD}; SQL fragment: Quality label="Qual&HY.ity",
Notice the dot to end the macro variable reference.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.