sas

Variable Length

Syntax#

  • LENGTH variable(s) <$>length;

Parameters#

Parameter Details
variable(s) variable(s) you wish to assign a length to
$ optional parameter that specifies if your variable is a character variable
length integer that specifies the length of the variable
## Assigning length to a character variable
data table;
set table;
length state_full $8;
if state = 'KS' then state_full = 'Kansas';
else if state = 'CO' then state_full = 'Colorado';
else state_full = 'Other';
run;

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow