![]() ![]() The PUT statement with a format after the variable name uses a format to write data values in a DATA step.įor example, the PUT statement with the DOLLARw.d format can be used to write the numeric value for AMOUNT as a dollar amount: amount=1145.32 In an ATTRIB statement in a DATA step or a PROC step.In a FORMAT statement in a DATA step or a PROC step.You can use formats in the following ways: When the value of d is greater than fifteen, the precision of the decimal value after the 15th decimal place might not be accurate. If this attempt fails, an error message that describes the problem appears in the SAS log. If incompatible SAS formats are used, such as using a numeric format to write character values, SAS first attempts to use a comparable format of the other type. Numeric formats sometimes revert to the BESTw.d format. x=123 Ĭharacter formats truncate values on the right. In the following example, the result is x=**. If adequate is not specified, SAS prints asterisks. SAS tries to adjust the value into the space available if the format width is too narrow to represent a value. The remaining columns include the decimal point, the remaining numeric value, a minus sign if the value is negative, the dollar sign, and commas, if any. This leaves eight columns for all the remaining characters in the value. The internal data values are not truncated or changed with the formats.įor example, in DOLLAR10.2, the w value of 10 specifies printing a maximum of 10 columns for the value, and the d value of 2 specifies that two of these columns are for the decimal part of the value. The d value you specify with SAS formats indicates the number of decimal places. ![]() Default values are used if you omit the format’s w and the d values. SAS Format always contains a period (.) as a part of the name. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |