BookmarkSubscribeRSS Feed
vidyapedii
Fluorite | Level 6

How many characters can be used in a label?
a. 96
b. 200
c. 256
d. 32,767

 

sas prep guide answer is  32,767, 

but everywhere i searched l it is 256

 

5 REPLIES 5
Reeza
Super User
Which prep guide and what version? Did you check the errata page for an issue?
FreelanceReinh
Jade | Level 19

Hi @vidyapedii,

 

Also, the context of the question is relevant: If "label" means a formatted value in a format definition, then 32,767 is correct, whereas a variable label and a data set label have a maximum length of 256. (In the context of graphics there are axis labels, tick mark labels, ...)

PaigeMiller
Diamond | Level 26

So, @vidyapedii, following up on the point by @FreelanceReinh, what is the exact wording of the question?

--
Paige Miller
Rick_SAS
SAS Super FREQ

I, too, prefer the doc, but you can also write a program to experiment/validate. Here is a program that makes a string of length N and puts it into a macro variable (which also has a maximum length). If you use this value in the LABEL statement to set a variable label, you can see whether it works for 257 length:

 

%let N = 257;
data _NULL_;
length L $&N;
L = subpad("A",1,257);
call symput("lbl", L);
run;

data Want;
label A = "&lbl";
a = 1;
run;

For this program, you get the following WARNING:

WARNING: Label value for variable A has been truncated to a length of 256
bytes.

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 4655 views
  • 9 likes
  • 5 in conversation