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

Hello all,

sas variable name length is 32 character,however sas says that character variables can be up to 32,767 bytes long.it is confusing for me .character length is 32 or 32,767? I appreciate if anyone enlighten me.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

The name of the variable can be up to 32 bytes long. The value that is stored in the variable can be up to 32,767 bytes long.

 

It is like the difference in the number of letters in the title of a book and the number of letters on the pages of the book.

 

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

The name of the variable can be up to 32 bytes long. The value that is stored in the variable can be up to 32,767 bytes long.

 

It is like the difference in the number of letters in the title of a book and the number of letters on the pages of the book.

 

ballardw
Super User

Labels for variables may contain more text to describe variables though, 256 characters currently and can contain spaces and some special characters.

See this code for a brief example:

data example;

   x=123;

   label x='This is a demonstration label for a generic variable named X';

run;

 

proc print data=example label;

   var x;

run;

 

some procedures will default to showing all or part of a label when used, others like print want an explicit instruction to use the labels.

Labels may be permanent, as assigned in the step that creates them or temporary for a specific procedure call:

proc print data=example label;

   var x;

   label x='Shorter label for x';

run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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