DATA Step, Macro, Functions and more

sas variable name length

Accepted Solution Solved
Reply
Contributor
Posts: 46
Accepted Solution

sas variable name length

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.


Accepted Solutions
Solution
‎02-15-2018 07:15 PM
Super User
Super User
Posts: 8,273

Re: sas variable name length

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


All Replies
Solution
‎02-15-2018 07:15 PM
Super User
Super User
Posts: 8,273

Re: sas variable name length

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.

 

Super User
Posts: 13,926

Re: sas variable name length

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;

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 382 views
  • 3 likes
  • 3 in conversation