![]() Chapter Contents |
![]() Previous |
![]() Next |
| FORMAT |
| Valid: | in a DATA step or PROC step |
| Category: | Information |
| Type: | Declarative |
| Syntax | |
| Arguments | |
| Details | |
| Comparisons | |
| Examples | |
| Example 1: Assigning Formats and Defaults | |
| Example 2: Removing a Format | |
| See Also | |
Syntax |
|
FORMAT variable(s) <format>
<DEFAULT=default-format>; |
A DEFAULT= format specification applies to
| Details |
| Comparisons |
| Examples |
This example uses a FORMAT statement to assign formats and default formats for numeric and character variables. The default formats are not associated with variables in the data set but affect how the PUT statement writes the variables in the current DATA step.
data tstfmt;
format W $char3.
Y 10.3
default=8.2 $char8.;
W='Good morning.';
X=12.1;
Y=13.2;
Z='Howdy-doody';
put W/X/Y/Z;
run;
proc contents data=tstfmt;
run;
proc print data=tstfmt;
run;
The SAS System 3
CONTENTS PROCEDURE
-----Alphabetic List of Variables and Attributes-----
# Variable Type Len Pos Format
----------------------------------------------
1 W Char 3 16 $CHAR3.
3 X Num 8 8
2 Y Num 8 0 10.3
4 Z Char 11 19 |
The SAS System 4
OBS W Y X Z
1 Goo 13.200 12.1 Howdy-doody |
The PUT statement produces this result:
----+----1----+----2 Goo 12.10 3.200 Howdy-do
data rtest; set rtest; format x; run;
| See Also |
Statement:
| |||
| The DATASETS Procedure in SAS Procedures Guide |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.