{
  "name": "SAS numeric-to-character expressions: formats and receiving lengths",
  "description": "Original compilation from SAS function and format reference entries linking six numeric-to-character expressions to their output rules and default receiving lengths. Lengths apply to a previously undefined character variable in a DATA step; an earlier declaration takes precedence.",
  "page": "https://casrai.org/guides/sas-put-numeric-to-character",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-26T15:45:00Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Expression",
      "unit": "",
      "description": ""
    },
    {
      "name": "Output rule",
      "unit": "",
      "description": ""
    },
    {
      "name": "Default new variable length",
      "unit": "bytes",
      "description": ""
    },
    {
      "name": "Review point and reference",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Expression": "put(id, z6.)",
      "Output rule": "Numeric output padded on the left with zeros",
      "Default new variable length": 6,
      "Review point and reference": "Choose a width that accommodates the value; rounding and width restrictions apply. SAS Zw.d format and PUT entries."
    },
    {
      "Expression": "put(score, 8.2)",
      "Output rule": "Numeric output with two decimal places in a width-eight field",
      "Default new variable length": 8,
      "Review point and reference": "Width includes the sign and decimal point. Too-narrow fields can change representation. SAS w.d format and PUT entries."
    },
    {
      "Expression": "put(value, best32.)",
      "Output rule": "Width-dependent numeric representation; may use scientific notation",
      "Default new variable length": 32,
      "Review point and reference": "Trailing zeros are not written; not a fixed-decimal representation. SAS BESTw. format and PUT entries."
    },
    {
      "Expression": "put(id, 12. -L)",
      "Output rule": "Left-aligned numeric output in a width-twelve field",
      "Default new variable length": 12,
      "Review point and reference": "Alignment changes placement within the field, not the receiving length. SAS PUT entry."
    },
    {
      "Expression": "strip(put(id, 12.))",
      "Output rule": "Removes surrounding blanks from the intermediate character string",
      "Default new variable length": 12,
      "Review point and reference": "Assignment does not shorten the receiving variable; trailing blanks can be added again. SAS STRIP and PUT entries."
    },
    {
      "Expression": "putn(id, 'z6.')",
      "Output rule": "Numeric format supplied at run time",
      "Default new variable length": 200,
      "Review point and reference": "Declare the target length explicitly when the default is unsuitable. SAS PUTN entry."
    }
  ],
  "sources": [
    {
      "title": "SAS 9.4 Functions and CALL Routines: Reference, Fifth Edition",
      "url": "https://documentation.sas.com/api/docsets/lefunctionsref/9.4/content/lefunctionsref.pdf",
      "accessed": "2026-11-16"
    },
    {
      "title": "SAS 9.4 Formats and Informats: Reference",
      "url": "https://support.sas.com/documentation/cdl/en/leforinforref/64790/PDF/default/leforinforref.pdf",
      "accessed": "2026-11-16"
    }
  ]
}