UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SAS Code Fragments
Copying and Combining SAS Format Libraries

How do you combine SAS format libraries? 

Say you have a format library in e:\temp\data1 and a format library in e:\temp\data2 and you want to combine them.  Here is how you can do this.  BEFORE YOU DO THIS, you should make a copy of the format library in e:\temp\data2 since it will be overwritten in this process.

libname first "e\temp\data1";
libname second "e\temp\data2";

proc catalog cat=first.FORMATS;
  copy out=second.FORMATS;
run;

What if the format library in e:\temp\data1 was a version 6 format library?  In that case, use the v6 engine like this.

libname first v6 "e\temp\data1";
libname second "e\temp\data2";

proc catalog cat=first.FORMATS;
  copy out=second.FORMATS;
run;

You can use this trick to copy a SAS version 6 format library to a SAS version 8 format library, like below.  This copies e:\temp\data1\formats.sc2 to e:\temp\data2\formats.sas7bcat (a version 8 format library).

libname first v6 "e:\temp\data1";
libname second v8 "e:\temp\data2";

proc catalog cat=first.FORMATS;
  copy out=second.FORMATS;
run;

proc format library=second fmtlib;
run;
 

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California