BookmarkSubscribeRSS Feed
SasStatistics
Pyrite | Level 9

In reading others programs, I have seen that people use labels (I see this by running the proc contents step). 

In the documentation: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1r8ub0jx34xfsn1ppcjfe0u16pc.htm 
it is clear how you do labels. But it does not say why you would like to use it. 

My question is, why would I like to use labels?

Also, when for instance printing out a data set, the labels rather than the "actual variable name" is displayed. Why? Is this always the case?

Thanks. 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Contrary to the subject line you typed, labels do not "name" variables, they add additional information that can make output much more readable in most situations. If you have a variable with a cryptic name, such as ANWTQZ, it would make a lot more sense to have a label appear in the output that says "Animal Weight Using Supplement QZ".

 

So, my question is: why would you NOT use labels?

 

If you don't want labels to appear (why not?) then you can use

options nolabel;

to turn them off before creating output.



--
Paige Miller
ballardw
Super User

Variables are limited to 32 characters. Which may not be enough to make nice text to describe something.

Labels can be much longer and don't have the limitations of which characters can be used.

 

Proc Print by default does not print the label. You have to ask for that with the LABEL option on the Proc Statement. Wizards and widgets may default to the label (or using that option).

 

Many other procedures will use the label when one is available by default.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 402 views
  • 4 likes
  • 3 in conversation