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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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