<?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: User Defined Formats not Doing Anything to Values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225544#M53946</link>
    <description>&lt;P&gt;And the code runs without errors/warnings? &amp;nbsp;The reason I ask is that I have run that code on 9.3 and it will not work. &amp;nbsp;Mylibrary is more than 8 characters long. &amp;nbsp;Maybe your EG is 9.4 I don't know. &amp;nbsp;&lt;/P&gt;&lt;P&gt;I would check to see if there is a catalog called formats in the library you have created as this code worked fine for me, do note that if the format code is not in the same section of code to the current one then you need to do options fmtsearch=(mylib); and of course make sure the library mylib is assigned before that:&lt;/P&gt;&lt;P&gt;libname mylib "s:\temp\rob";&lt;/P&gt;&lt;P&gt;proc format library = mylib cntlout = mylib.formats;&lt;BR /&gt;value $noyes&lt;BR /&gt;"1" = "Yes"&lt;BR /&gt;"2" = "No";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data output;&lt;BR /&gt;oldvar="1";&lt;BR /&gt;newvar = strip(put(oldvar, $noyes.));&lt;BR /&gt;output;&lt;BR /&gt;oldvar="2";&lt;BR /&gt;newvar = strip(put(oldvar, $noyes.));&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Sep 2015 12:05:32 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-09-15T12:05:32Z</dc:date>
    <item>
      <title>User Defined Formats not Doing Anything to Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225527#M53939</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently working in SAS EG 6.1, and I am trying to convert character&amp;nbsp;variables into their formatted counterparts using the put function. My program runs fine, no errors/warnings but the values do not change like I expect them too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example of the format I have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;value $noyes&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "1" = "Yes"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "2" = "No";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now this is one format which is&amp;nbsp;stored in my permanent format catalogue, and a define a LIBNAME statement for it's location and I then use the following option to tell SAS EG where the catalogue is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options fmtsearch = (LIBNAME);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in my program I go to derive a new variable, call it NEWVAR, like so&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data out;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; set in;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;newvar = strip(put(oldvar, $noyes.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now like I said no errors/warnings, the format is found but does nothing. The values in the OLDVAR are "1" and "2" only. OLDVAR is character. Oddly though, if i define $NOYES. in the same program, i.e. if i copy the above proc format above the data set and run, it will work perfectly. Any ideas??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I explained this as well as i could, thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 09:05:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225527#M53939</guid>
      <dc:creator>craig159753</dc:creator>
      <dc:date>2015-09-15T09:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Formats not Doing Anything to Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225529#M53940</link>
      <description>&lt;P&gt;What is the name of the format catalog? &amp;nbsp;You may need to specify it. &amp;nbsp;fmtsearch=(libname.myfmts) perhaps.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 10:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225529#M53940</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-09-15T10:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Formats not Doing Anything to Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225530#M53941</link>
      <description>&lt;P&gt;Thanks for the reply, the catalogue is called FORMATS, I tired your suggestion no luck. I have also tried renaming it something totally different. Still no luck &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 10:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225530#M53941</guid>
      <dc:creator>craig159753</dc:creator>
      <dc:date>2015-09-15T10:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Formats not Doing Anything to Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225534#M53943</link>
      <description>&lt;P&gt;Not sure if this will be the reason, however in your proc format step you are missing a semicolon after the format. &amp;nbsp;This code should work fine. &amp;nbsp;If it still doesn't work when you fix this, then it probably isn't finding the format catalog and you will need to post your code for initialising the format catalog, and using it.&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;value $noyes&lt;BR /&gt;"1" = "Yes"&lt;BR /&gt;"2" = "No";&lt;BR /&gt;run;&lt;BR /&gt;data want;&lt;BR /&gt;a="1"; b="1"; c=put(a,$noyes.); d=put(b,$noyes.);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 10:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225534#M53943</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-09-15T10:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Formats not Doing Anything to Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225542#M53944</link>
      <description>&lt;P&gt;Thanks for the reply, the missing semi colon was a typo on here, the proc format code for my catalogue is like the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format library = mylibrary&amp;nbsp;cntlout = mylibrary.formats;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;value $noyes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"1" = "Yes"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"2" = "No";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;BR /&gt;&lt;BR /&gt;I can see the catalogue is present and contains this $NOYES format by looking at the SASHLP.VCFORMAT and SASHELP.VCATALG data sets.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The actual code for using it was like in my first post&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;newvar&amp;nbsp;= strip(put(oldvar, $noyes.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 11:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225542#M53944</guid>
      <dc:creator>craig159753</dc:creator>
      <dc:date>2015-09-15T11:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Formats not Doing Anything to Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225544#M53946</link>
      <description>&lt;P&gt;And the code runs without errors/warnings? &amp;nbsp;The reason I ask is that I have run that code on 9.3 and it will not work. &amp;nbsp;Mylibrary is more than 8 characters long. &amp;nbsp;Maybe your EG is 9.4 I don't know. &amp;nbsp;&lt;/P&gt;&lt;P&gt;I would check to see if there is a catalog called formats in the library you have created as this code worked fine for me, do note that if the format code is not in the same section of code to the current one then you need to do options fmtsearch=(mylib); and of course make sure the library mylib is assigned before that:&lt;/P&gt;&lt;P&gt;libname mylib "s:\temp\rob";&lt;/P&gt;&lt;P&gt;proc format library = mylib cntlout = mylib.formats;&lt;BR /&gt;value $noyes&lt;BR /&gt;"1" = "Yes"&lt;BR /&gt;"2" = "No";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data output;&lt;BR /&gt;oldvar="1";&lt;BR /&gt;newvar = strip(put(oldvar, $noyes.));&lt;BR /&gt;output;&lt;BR /&gt;oldvar="2";&lt;BR /&gt;newvar = strip(put(oldvar, $noyes.));&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 12:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225544#M53946</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-09-15T12:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: User Defined Formats not Doing Anything to Values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225636#M53956</link>
      <description>&lt;P&gt;Hi. &amp;nbsp;Try this and see if it helps ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* some data;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data x;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;input x :$1. @@;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;1 2 1 2&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* location of format library;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;libname mylib 'z:\';&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* create a format ;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* creates a CATALOG named FORMATS (default&amp;nbsp;if&amp;nbsp;no other name specified) in the library MYLIB;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* NO NEED for that CNTLOUT option (useless);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;proc format library=mylib;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;value $noyes&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;"1" = "Yes"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;"2" = "No";&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* extra step for now ... check to see if the new format is in the catalog within the library;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;proc catalog cat=mylib.formats;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;contents;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* tell SAS to include the new format catalog when looking for a formats;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* since you did not give the catalog a name, SAS infers that it chould look for a catalog named FORMATS in MYLIB;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;options fmtsearch=(mylib);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* use the format (do not need STRIP function ... useless);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data xplus;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;set x;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;y = put(x,$noyes.);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output from PROC CATALOG ...&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;Contents of Catalog MYLIB.FORMATS&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;# Name &amp;nbsp;Type &amp;nbsp; &amp;nbsp; Create Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Modified Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Description&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;1 NOYES FORMATC 09/15/2015 11:46:53 09/15/2015 11:46:53&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data set XPLUS ...&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;Obs x y&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;1 &amp;nbsp; 1 Yes&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;2 &amp;nbsp; 2 No&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;3 &amp;nbsp; 1 Yes&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;4 &amp;nbsp; 2 No&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More info ...&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Yes, We Can... Save SAS®&amp;nbsp;Formats&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings12/048-2012.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings12/048-2012.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 15:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-Defined-Formats-not-Doing-Anything-to-Values/m-p/225636#M53956</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2015-09-15T15:58:19Z</dc:date>
    </item>
  </channel>
</rss>

