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.
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.
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;
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;
Hi @novinosrin,
proc catalog catalog = frmtdir.formats;
contents;
run;
worked very well, others i got error messagges, thank you very much.
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
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.
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.
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.
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: