Skip to contents

When called with named arguments, sets the format.sas attribute on the specified columns. When called without arguments, returns current formats.

Usage

set_format(data, ...)

Arguments

data

A data frame.

...

Named arguments where names are column names and values are SAS format strings (e.g., "DATE9.", "8.1", "$20.").

Value

When setting: the data frame with updated format attributes. When getting: a named character vector of formats.

Examples

df <- data.frame(ADT = as.Date("2024-01-01"), AVAL = 1.5)
df <- set_format(df, ADT = "DATE9.", AVAL = "8.1")
set_format(df)
#>      ADT     AVAL 
#> "DATE9."    "8.1"