Pages

Wednesday, October 9, 2013

Widgets

Aligning Character Values with a Put Function

We often use LEFT and RIGHT SAS functions to align the character values. This can also be achieved by PUT function.

Let us see this with and example:

data temp;
 
alphabetw='  a  ';
chardate=put(alphabetw,$10. -l);
output ;
chardate=put(alphabetw,$10. -c);
output ;
chardate=put(alphabetw,$10. -r);
output ;
 
run;


proc print;run;
 
Obs    alphabetw  chardate
 
 1        a       a
 2        a           a
 3        a                a

No comments:

Post a Comment