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;
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.