I would like to replace the formats of a data set by some standard formats based on the type of format. That is, I would like to specify a specific format for the following categories of variables:
It is straightforward to determine using code whether a variable is character or numeric. For example, using PROC CONTENTS, the information in SASHELP.VCOLUMN or the variable info functions (vtype, vtypex).
Is there also a way to determine the category of the format of the variable (date, datetime, etc.) using the format that is applied? Similar to the categories as described in the SAS programming documentation: Formats by category.
Information about the format is available in the three sources mentioned above, but I would like to avoid having to create the list of valid date and datetime formats myself.
Hello @NicoM,
@NicoM wrote:
Is there also a way to determine the category of the format of the variable (date, datetime, etc.) using the format that is applied?
Yes, there is: the FMTINFO function, as Tom illustrated last week in https://communities.sas.com/t5/SAS-Programming/Identify-List-all-date-fields/m-p/727124.
Hello @NicoM,
@NicoM wrote:
Is there also a way to determine the category of the format of the variable (date, datetime, etc.) using the format that is applied?
Yes, there is: the FMTINFO function, as Tom illustrated last week in https://communities.sas.com/t5/SAS-Programming/Identify-List-all-date-fields/m-p/727124.
Thanks, @FreelanceReinh! That is exactly what I need.
I searched using keywords "format" and "category", but I did not come across that thread.
@NicoM wrote:
I searched using keywords "format" and "category", but I did not come across that thread.
I was just lucky that I remembered the discussion, so I could restrict my search to posts by user Tom, date: "A month ago." 🙂
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.