As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Tip of the Day:June 3

From sasCommunity
Jump to: navigation, search

sasCommunity Tip of the Day

As part of the decommissioning effort for this article/tip has been migrated to

The new home for this article/tip is June 3 (

While we often use SAS functions LEFT and RIGHT to align character values, we can also achieve the same item with the use of PUT function.

In the PUT function section in the SAS documentation, there is a specific section on this. See an example at right.

NOTE: The -l, -c, and -r format modifiers can also be used in PUT statements.

data temp;
alphabetw='  a  ';
chardate=put(alphabetw,$10. -l);
output ;
chardate=put(alphabetw,$10. -c);
output ;
chardate=put(alphabetw,$10. -r);
output ;
proc print;run;
Obs    alphabetw  chardate
 1        a       a
 2        a           a
 3        a                a

Submitted by Murphy Choy. Contact me at my Discussion Page.

Feel free to comment on this tip.

Prior tip - Next tip - Random Tip

Submit a Tip