Hi experts,
In a datastep (or any other way) how do I know if the format associated with some column in the dataset is a built-in format or a user-written format?
Thanks!
You can query SASHELP.VFORMAT
If the variable LIBNAME is missing, then it is a built-in format. Otherwise, it is user created.
You can query SASHELP.VFORMAT
If the variable LIBNAME is missing, then it is a built-in format. Otherwise, it is user created.
Turns out there is a pre-built view called sashelp.vcformat which lists only user-written formats
You can't tell from the code which formats are user-defined, but you can programmatically list all formats available in your SAS session and identify which ones are user-defined like this (user-defined formats will be at the top of the list):
proc sql;
select fmtname
,case
when memname is null then 'Built-in'
else 'User-defined'
end as Source
from dictionary.formats
order by 3 desc, 2, 1
;
quit;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.