BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
chinaski
Obsidian | Level 7

Hi, i have some difficulties for reaching the contents of my format library, although i know how to create format, store it into a library that i have created and how to recall that formats for the future use but i don't know how to list its contents and see if there is something useful for my ongoing task, so i want a list of formats in that library that i created in the past to see what is inside it. By that way i will be able to decide whether to create new formats i need or i already created in the past and i can use them right away.

 

So, in short i want to see;

 

1) Which formats i created so far and to where (which permanent libraries).

2) Lists of formats that i created in each permanent libraries.

 

and by the help of these two, i could be able to decide whether i have to create new formats or i can use the formats that i created in the past.

 

Thank you for your time and help.

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @chinaski,

 

My usual method of reviewing format definitions is the one suggested by @Astounding.

 

By adding a SELECT statement you can restrict the results to one or more individual formats or groups of formats (specified by partial format names or lists of format names), e.g.

proc format fmtlib lib=your_lib;
select $:;
run;

selects all character formats (in your_lib) because their names begin with a dollar sign.

View solution in original post

10 REPLIES 10
Reeza
Super User
Try SASHELP.VFORMAT table which has all the formats created and some metadata on them as well.
chinaski
Obsidian | Level 7

Hi Reeza,

 

I didn't get how to use it in my code, can you give me an example on how to use this? Thank you.

 

Lets say our format is this:

 

proc format library=mylibrary;
value income low-2000="low"
             2000<-6000="middle"
             6000<-high="high";
             run;

Reeza
Super User

What are you trying to do there? I'm not sure. I was answering your original question, which was to find which library and formats are available. You can do that via the following, which will tell you the library name and the format. 

 

proc freq data=sashelp.vformat;
where source='C';
table libname*fmtname / list;
run;

The answers above, assume you know the library, but I interpreted your question more generally. 

 

 

 


@chinaski wrote:

Hi Reeza,

 

I didn't get how to use it in my code, can you give me an example on how to use this? Thank you.

 

Lets say our format is this:

 

proc format library=mylibrary;
value income low-2000="low"
             2000<-6000="middle"
             6000<-high="high";
             run;


 

chinaski
Obsidian | Level 7

Hi @novinosrin,

 

proc catalog catalog = frmtdir.formats;
contents;
run;

 

worked very well, others i got error messagges, thank you very much.

novinosrin
Tourmaline | Level 20

I must thank you for this question. The last time I used proc catalog was Feb2015. Feels like it's been ages 🙂 It was nice to review all the basics.

 

I am glad you chose @FreelanceReinh 's answer. I don't like golf but do like this golfer a lot. lol

 

 

SASKiwi
PROC Star

If you use Enterprise Guide as your SAS interface then the Catalogs and Formats Explorer available on the Tools menu is useful for this. This is a fairly new so it may not be available in older versions of EG.

Astounding
PROC Star

Don't you need more than a list of format names?  You can get the contents of the formats in a library using:

 

proc format library=mylib.formats fmtlib;

run;

 

But you do need some of the earlier-suggested steps to get a list of which format libraries exist.

chinaski
Obsidian | Level 7

Hi @Astounding

 

Thank you very much for your answer, it worked perfectly well.

FreelanceReinh
Jade | Level 19

Hi @chinaski,

 

My usual method of reviewing format definitions is the one suggested by @Astounding.

 

By adding a SELECT statement you can restrict the results to one or more individual formats or groups of formats (specified by partial format names or lists of format names), e.g.

proc format fmtlib lib=your_lib;
select $:;
run;

selects all character formats (in your_lib) because their names begin with a dollar sign.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 10 replies
  • 4529 views
  • 10 likes
  • 6 in conversation