Here's the situation. I create a SAS Data set, where some of the variables have custom formats. Then, a colleague asks me to share this data set with him, but he can't open it because he doesn't have the custom formats.
I know he can use the NOFMTERR option and then he can open the SAS data set, but then he can't see the custom formatted data.
I know I can create a permanent format library and also share that with my colleague, and he can then issue the FMTSEARCH= option appropriately.
Is there a better or easier way?
You can either send the format catalog or send the format in a data set and then let the reciever read the format themselves. By using the latter you avoid compatability issues.
@rudfaden wrote:
... or send the format in a data set ...
I don't know how to send the format in a data set. Please give an example.
Thanks!
How is that superior to creating a permanent format library, and then having my colleague use the FMTSEARCH= option?
I don't know if you can call it superior. But if you share a catalog between e.i. a 64 and 32 bit SAS, you will not be able to read the format catalog. But you can create the format from the data.
With CEDA (ability to read data written using a different SAS version or different operating system) a SAS dataset (SAS7BDAT file) is easier to transfer than a format catalog. To transfer a format catalog to a different version of SAS you need to create a transport file.
For most formats the best way to share them is to send the SAS code to create the format.
@Tom wrote:
With CEDA (ability to read data written using a different SAS version or different operating system) a SAS dataset (SAS7BDAT file) is easier to transfer than a format catalog. To transfer a format catalog to a different version of SAS you need to create a transport file.
For most formats the best way to share them is to send the SAS code to create the format.
For this particular custom format, it is created within a large macro, and so I don't have static code that I can save and then send. Each time the macro runs, it may create different PROC FORMAT code. In this case, it sounds to me that the CNTLOUT= method to save the format as a SAS data set would be the best way.
Thanks again.
Makes sense. You can also convert the CNTLOUT/CNTLIN dataset into a text file (CSV for example) to make it even more portable.
Also depending on how the dynamic formats are being generated the macro might also create a the program file with the PROC FORMAT code to create the needed formats to the current run.
Sir @Tom
I seek your clarification as I understand that meaning share/place the code in a server in multi user environment perhaps as an autoexec file, of course restricting users to appropriate departments in the organization?
@novinosrin wrote:
Sir @Tom
I seek your clarification as I understand that meaning share/place the code in a server in multi user environment perhaps as an autoexec file, of course restricting users to appropriate departments in the organization?
Not sure what you are asking. If you have shared format catalogs you could just share them. The FMTSEARCH option can be used to control which catalogs are searched. Of course you might have issues with name conflicts if you have many independent format catalogs that users might need to work with together. Naming conventions can help with that. You might want to implement a hierarchy of format definitions and reflect that in the storage and search order. So you might have company wide formats, department level, project level. Then set your search path appropriately.
"You might want to implement a hierarchy of format definitions and reflect that in the storage and search order. So you might have company wide formats, department level, project level. Then set your search path appropriately."
That's what I wanted to learn. Cool. Sorry if i didn't phrase the question properly. Well, you comprehended it clean. Thank you for your time! Appreciate it
proc format ; value fmt low-12='Y' other='N'; run; proc format library=work cntlout=fmt; select fmt; run; /****Your colleague side ,run this ******/ proc format cntlin=work.fmt; run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.