SAS Component Language Dictionary |
Category: | Formatting |
Syntax | |
Details | |
Examples | |
Example 1: Using the PUTC Function | |
Example 2: Using the PUTN Function | |
See Also |
Syntax |
formatted-val=PUTC(char-val,format); |
formatted-val=PUTN(num-val,format); |
is the character format to apply with PUTC or the numeric format to apply with PUTN. Format can be an SCL variable or a character literal.
Details |
Dot notation cannot be used with the PUTC or PUTN functions. This restriction is necessary to allow proper parsing of the char-val and num-val parameters.
For more information about using a format to return a value, see the PUT function in SAS Language Reference: Dictionary.
Examples |
Format the value that a user enters into the text entry control named VALUE:
MAIN: value=putc(value,'$QUOTE.'); put value=; return;
Entering SAS into the field displays "SAS" in the field and produces the following output:
VALUE="SAS"
Format the variable NETPD using the DOLLAR12.2 format, and store the value in the variable SALARY.
INIT: netpd=20000; put netpd=; fmt='dollar12.2'; salary=putn(netpd,fmt); put salary=; return;
This program produces the following output:
NETPD=20000 SALARY= $20,000.00
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.