BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
metallon
Pyrite | Level 9

Hi,

is there a way to do a linebreak for a long custom LABEL name for a sas data set variable?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.   [cautionend]

View solution in original post

4 REPLIES 4
ballardw
Super User

Where to expect to see the linebreak take effect? SAS output such as proc contents, the explorer window or elsewhere?

Tom
Super User Tom
Super User

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.   [cautionend]

metallon
Pyrite | Level 9

Awesome! Thats what I needed!

Peter_L
Quartz | Level 8

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 11837 views
  • 4 likes
  • 4 in conversation