BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello,

 

I am using the attrib, label, length, format and informat statement to create a data model

Is there a way to get the label in two lines

 

ex: Written Premium - Previous Year

for Written Premium

       Previous Year

 

Here's the basic code

The split did not work

 

libname temp %sysfunc(quote(%sysfunc(pathname(work))));

data temp.model ;
   attrib GENRE 	label="Genre" length=8 format=8. informat=8.
    	  TYPE3 	label="Type3" length=8 format=8. informat=8.
          WP 		label="Written Premium" length=8 format=8. informat=8.
		  SEMOSPC 	label="Written Premium ||'0D'x|| Previous Year" length=8 format=8. informat=8.
;
run

 

6 REPLIES 6
Reeza
Super User
Depends, where do you want to see the split? Within a SAS data set - not really. Within an output/printed output like RTF/PDF/Excel doc, then yes, you can split things. Can you provide more details about what you're trying to accomplish?
alepage
Barite | Level 11
I was looking for a solution with sas dataset
Tom
Super User Tom
Super User

@alepage wrote:
I was looking for a solution with sas dataset

Since there is no concept of "lines" in the label of a variable you can just use whatever character you want to indicate the location of the logic split into "lines". You might use | or / or * for example.

 

You might want to pick one that works with other procedures.  Such as the SPLIT= option of PROC PRINT.

Reeza
Super User
Out of curiousity, why? What would be the purpose for the label in the data set to have a split? You want to see it in viewer?
alepage
Barite | Level 11

It is because, sometime the dataset label  is to long.  Ex: Written Premium - Previous Year.

 

I would prefer to get:

 

Witten Premium

Previous Year

 

Cynthia_sas
SAS Super FREQ
Hi: But where would you be able to see that it was too long? In a report? In the data viewer? In the results of a statistical procedure? In the output of a graph procedure? You don't "see" inside the SAS dataset when it is stored, and not being actively used.
Inside the SAS dataset, when the labels are stored in the descriptor portion of the data, there is no concept of "lines" or line feeds or carriage returns. The label is stored as a piece of "descriptor" information about the column. You only "see" that label when the label is used to produce output or when the label is used in a table viewer.
Cynthia

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 6 replies
  • 1409 views
  • 2 likes
  • 4 in conversation