BookmarkSubscribeRSS Feed
Konkordanz
Pyrite | Level 9

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?

3 REPLIES 3
PaigeMiller
Diamond | Level 26

The best solutions for allowing colleagues to use the data set:

 

  • provide them with the PROC FORMAT code
  • provide them with a format library (along with the data set) and instructions on how to use it
  • have colleagues use the option NOFMTERR, but then they will only see the unformatted values
--
Paige Miller
Tom
Super User Tom
Super User

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.

Konkordanz
Pyrite | Level 9

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

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
  • 3 replies
  • 507 views
  • 2 likes
  • 3 in conversation