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

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?

--
Paige Miller
1 ACCEPTED SOLUTION
12 REPLIES 12
rudfaden
Lapis Lazuli | Level 10

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.

PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
PaigeMiller
Diamond | Level 26

Thanks!

 

How is that superior to creating a permanent format library, and then having my colleague use the FMTSEARCH= option?

--
Paige Miller
rudfaden
Lapis Lazuli | Level 10

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. 

Tom
Super User Tom
Super User

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.  

PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
Tom
Super User Tom
Super User

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.

novinosrin
Tourmaline | Level 20

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?

Tom
Super User Tom
Super User

@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.

novinosrin
Tourmaline | Level 20

"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

Ksharp
Super User
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;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 12 replies
  • 5562 views
  • 7 likes
  • 5 in conversation