Hi,
I have written a huge proc-format-code and used it for value-labeling a specific dataset. Afterwards I wanted to save the labled dataset in my companys network, so each colleague can use the final result. But within the dataset it didnt save the proc-format-definitions (value labels). How can I save them into the dataset?
I red, that one can reuse proc-format-definitions, if they are saved in a sas-catalog; is that right? Does that mean, that the definitions are saved locally on my pc and not within the dataset? So I always have to share my dataset AND the proc-format-syntax?
The best solutions for allowing colleagues to use the data set:
You are right. The definition of the formats is NOT stored in the dataset. All that is stored in the dataset is the format specification itself. That is the NAME of the format. The Width to use (if specified). The number of Decimal places to use (if specified).
To share the format definitions you can either store them into a format catalog. That will work as long as the users of the formats are using the same version of SAS (same operating system, same SAS version number, same bitness of the SAS 32 vs 64 bit). The users will need to have that format catalog listed in the search path specified by the FMTSEARCH option to be able to use the format catalog.
To share the format definition in a way that is more portable you could either share the SAS code that creates the format(s). Or share the SAS dataset generated by the CNTLOUT= option of PROC FORMAT. That way the user can recreate the format catalog on any version of SAS.
FORMATS are more general (and powerful) then "value-labels". They are instructions for how to convert values into text. In systems, like SPSS, that store value labels in the data you have to specify the code/decode pairs for similarly coded variables over and over again. With a FORMAT you can use the same format with many different variables across many different datasets.
Okay, thank you for your help. To be honest: It sounds a bit cumbersome to me if you always have to think about the dataset and the syntax or catalog at the same time. But well, maybe I'll discover advantages from this (compared to SPSS or Stata for example).
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.