BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
EyalGonen
Lapis Lazuli | Level 10

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!

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You can query SASHELP.VFORMAT

 

If the variable LIBNAME is missing, then it is a built-in format. Otherwise, it is user created.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

You can query SASHELP.VFORMAT

 

If the variable LIBNAME is missing, then it is a built-in format. Otherwise, it is user created.

--
Paige Miller
EyalGonen
Lapis Lazuli | Level 10

Turns out there is a pre-built view called sashelp.vcformat which lists only user-written formats

SASJedi
SAS Super FREQ

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;
Check out my Jedi SAS Tricks for SAS Users

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 878 views
  • 3 likes
  • 3 in conversation