Search notes:

SAS statements: length

By default, SAS creates each variable with a length of 8 bytes - longer character values are then truncated. The length statement (in a data step?) specifies a different length.

Set length of character variable

data _null_;

  length w1 $ 1;
  length w2 $ 2;
  length w3 $ 3;

  w1="foo";
  w2="bar";
  w3="baz";

  put w1=;
  put w2=;
  put w3=;
 
run;

/*

w1=f
w2=ba
w3=baz

*/
Github repository about-SAS, path: /programming/statements/length/set-length-of-character-variables.sas

See also

SAS statements

Index