<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Permanent Formats in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920653#M362603</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/439729"&gt;@jnivi&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The default setting of system option &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/p1fvn6rwmpf1njn1whkud1hmsc97.htm" target="_blank" rel="noopener"&gt;FMTSEARCH&lt;/A&gt; includes the libref LIBRARY, as shown in the PROC OPTIONS log below:&lt;/P&gt;
&lt;PRE&gt;31    proc options option=fmtsearch;
32    run;

    SAS (r) Proprietary Software Release 9.4  TS1M5

 &lt;STRONG&gt;FMTSEARCH=(WORK &lt;FONT color="#993366"&gt;LIBRARY&lt;/FONT&gt;)&lt;/STRONG&gt;
                   Specifies the order in which format catalogs are searched.
NOTE: PROCEDURE OPTIONS used (Total process time):
&lt;/PRE&gt;
&lt;P&gt;This means that user-defined formats and informats in a format catalog &lt;FONT face="courier new,courier"&gt;formats.sas7bcat&lt;/FONT&gt; stored in some directory (cf. the PROC FORMAT step in &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159" target="_blank" rel="noopener"&gt;Tom&lt;/A&gt;'s post) will be found if the libref LIBRARY is assigned to that directory (and if there is no format/informat with the same name in WORK.FORMATS). So in this situation you can just define&lt;/P&gt;
&lt;PRE&gt;libname library '&lt;EM&gt;some path&lt;/EM&gt;';&lt;/PRE&gt;</description>
    <pubDate>Mon, 18 Mar 2024 09:47:11 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2024-03-18T09:47:11Z</dc:date>
    <item>
      <title>Permanent Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920467#M362511</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question about permanently saving value formats in SAS. For example,&amp;nbsp; I have included my sample code for a variable in my "sample" dataset.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; value sex&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1="Male"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 2="Female"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sampledata;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;set sampledata;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;format sex sex.;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After running the above code, I am able to see the actual formats in my dataset (i.e male /female show up as the actual values in the dataset).&amp;nbsp; Once I save the dataset, and reload this dataset in a new session, I receive an error message stating that the format for sex can be found.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to apply this value format, to several variables in my dataset. I will also be sharing this dataset for others to use as well, so I was hoping there was a way to save the formats permanently so that I and others can see the actual value labels when the dataset is loaded in SAS.&amp;nbsp; I also tried opening my dataset in R, and I can see the formats were not automatically loaded ( i.e sex values are 1 and 2, instead of male and female).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason why I wanted the labels, but still wanted the variable to remain numeric is because I am working with multiple large datasets (some datasets being as large as 80GB) when the variables are formatted as character, so saving the variables as numeric with labels significantly reduces the size of the dataset.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for taking the time to read through my message, and I greatly appreciate any tips possible to solve my issue!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 15:02:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920467#M362511</guid>
      <dc:creator>jnivi</dc:creator>
      <dc:date>2024-03-15T15:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920472#M362513</link>
      <description>&lt;P&gt;Formats are independent of the variables you use them with.&amp;nbsp; So they are stored separately.&amp;nbsp; Formats are stored in a SAS catalog.&amp;nbsp;Your PROC FORMAT statement does not say where to write the new formats, so the default catalog of WORK.FORMATS is used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To save a dataset permanently you put it into a "library" by using a two level name. The same thing applies to format catalogs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For SAS to find the stored formats the catalog where they live needs to be included in the FMTSEARCH system option settings.&amp;nbsp; Since the default setting includes the WORK.FORMATS catalog then formats you created there are found.&amp;nbsp; But when you start a new session the WORK library is empty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib 'some path'; 
proc format lib=mylib.formats;
  value sex 
    1="Male"
    2="Female"
  ;
run;
options append=(fmtsearch=(mylib.formats));
data mylib.sampledata;
   set sampledata;
   format sex sex.;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then when you want to use them in a new session just define the libref and make sure that the catalog is included in the search path.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib 'some path'; 
options append=(fmtsearch=(mylib.formats));
proc freq data=mylib.sampledata;
  tables sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 15:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920472#M362513</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-15T15:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920632#M362597</link>
      <description>&lt;P&gt;Tom already gave you the solution.&lt;/P&gt;
&lt;P&gt;Alternative way is copying it into your WORK library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
libname x 'c:\temp\'; 
proc catalog ;
copy in=x.formats out=work.formats;
quit;

data x;
 input x;
format x x.;
cards;
1
2
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Mar 2024 06:01:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920632#M362597</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-03-18T06:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920653#M362603</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/439729"&gt;@jnivi&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The default setting of system option &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/p1fvn6rwmpf1njn1whkud1hmsc97.htm" target="_blank" rel="noopener"&gt;FMTSEARCH&lt;/A&gt; includes the libref LIBRARY, as shown in the PROC OPTIONS log below:&lt;/P&gt;
&lt;PRE&gt;31    proc options option=fmtsearch;
32    run;

    SAS (r) Proprietary Software Release 9.4  TS1M5

 &lt;STRONG&gt;FMTSEARCH=(WORK &lt;FONT color="#993366"&gt;LIBRARY&lt;/FONT&gt;)&lt;/STRONG&gt;
                   Specifies the order in which format catalogs are searched.
NOTE: PROCEDURE OPTIONS used (Total process time):
&lt;/PRE&gt;
&lt;P&gt;This means that user-defined formats and informats in a format catalog &lt;FONT face="courier new,courier"&gt;formats.sas7bcat&lt;/FONT&gt; stored in some directory (cf. the PROC FORMAT step in &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159" target="_blank" rel="noopener"&gt;Tom&lt;/A&gt;'s post) will be found if the libref LIBRARY is assigned to that directory (and if there is no format/informat with the same name in WORK.FORMATS). So in this situation you can just define&lt;/P&gt;
&lt;PRE&gt;libname library '&lt;EM&gt;some path&lt;/EM&gt;';&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Mar 2024 09:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920653#M362603</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-03-18T09:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Permanent Formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920863#M362690</link>
      <description>&lt;P&gt;As Freelance said, another way is here:&lt;/P&gt;
&lt;PRE&gt;libname x 'c:\temp\'; 
options fmtsearch=(x);
data x;
 input x;
format x x.;
cards;
1
2
;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Mar 2024 01:33:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permanent-Formats/m-p/920863#M362690</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-03-19T01:33:22Z</dc:date>
    </item>
  </channel>
</rss>

