Note, if SAS doesn’t display the format correctly, you might change the length of the format. Value Formatted Value Format Name Description 10000 10,000 COMMA12.0 Separates every 3 digits of a numeric value with a comma and a period for decimals 10000 10,000.00 COMMA12.2 Separates every 3 digits of a numeric value with a comma and a period for decimals 10000 10.000 COMMAX12.0 Separates every 3 digits of a numeric value with a period and a comma for decimals 10000 10.000,00 COMMAX12.2 Separates every 3 digits of a numeric value with a period and a comma for decimals 10000 $10,000 DOLLAR12.0 Same as COMMA format preceded by a $ sign 10000 $10,000.00 DOLLAR12.2 Same as COMMA format preceded by a $ sign 10000 $10.000 DOLLARX12.0 Same as COMMAX format preceded by a $ sign 10000 $10.000,00 DOLLARX12.2 Same as COMMAX format preceded by a $ sign 10000 10.000 € NLMNLEUR12.0 Euro currency (no decimals) 10000 10.000,00 € NLMNLEUR12.2 Euro currency (two decimals) 10000 10,000 £ NLMNLGBP12.0 GBP currency (no decimals) 10000 10,000.00 £ NLMNLGBP12.2 GBP currency (two decimals) 10000 10000% PERCENT10.0 Percentage with no decimals 10000 1.000E+04 E10. Instead of 3, SAS Base provides many numeric formats. The following SAS code generates a data set with 4 numeric variables which we will use in our examples. For example, by adding the dollar sign or dots and commas. The FORMAT statement is mostly used to format numeric variables. īelow we show in more detail how to use the FORMAT statement to change the look of numeric, character, and date variables. FORMAT income expenses DOLLAR10.2 transaction_date MMDDYY10. We also change the appearance of the variable transaction_date. FORMAT variable-name(s) format-name variable-name(s) format-name variable-name(s) format-name įor example, here we assign the same format to the variables income and expenses. Moreover, it can assign different formats to different variables. However, the FORMAT statement can associate the same format with various variables. Syntax of the FORMAT statement: FORMAT variable-name format-name Ī SAS Data Step can contain many FORMAT statements to format all variables one by one. This statement starts with the FORMAT keyword, the variable(s) you want to modify, and the desired format. To change the appearance of one or more variables within a SAS Data Step, you can use the SAS FORMAT statement. How to Format a Variable in a SAS Data Step
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |