<?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: Proc format :Applying custom format results in column with no values. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815769#M34251</link>
    <description>&lt;P&gt;I guess you did something to the dataset between the two PROC FREQs, or used different datasets. The number of missing values is not changed by a format that does not explicitly create missing values, or reformat them to a non-missing value. Both of which your format does not do.&lt;/P&gt;
&lt;P&gt;A value not "caught" by the format would be used raw (unformatted).&lt;/P&gt;
&lt;P&gt;Run both PROC FREQs which create your outputs, and the PROC FORMAT in immediate succession, and post the complete log of all three steps.&lt;/P&gt;</description>
    <pubDate>Tue, 31 May 2022 05:49:29 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-05-31T05:49:29Z</dc:date>
    <item>
      <title>Proc format :Applying custom format results in column with no values.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815757#M34246</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have character column to which i am applying a custom format. the problem is, when I create Frequency table after applying the format , no data appears. I am not sure where i am going wrong. Please help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Frequency tables with and without applying format are below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Myra22_0-1653968513749.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71884iE26CAA798298BAAA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Myra22_0-1653968513749.png" alt="Myra22_0-1653968513749.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Myra22_1-1653968540151.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71885iD228059C08626AA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Myra22_1-1653968540151.png" alt="Myra22_1-1653968540151.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc format ;
value $fcrust
"Crust Thickness Unknown"=0
"Continental Crust"=1
"Intermediate Crust"=2
"Oceanic Crust"=3;

proc freq data= Volcano123;
table Crust_type;
format Crust_type $fcrust.;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;Edit :&lt;/P&gt;&lt;P&gt;The table below is obtained from proc Contents shows that Crust_type is character type with no&amp;nbsp; specific format&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Myra22_0-1653977328585.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71888i1761EAE96CAC4632/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Myra22_0-1653977328585.png" alt="Myra22_0-1653977328585.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;proc format;
 value $fplate 
 "Intraplate" =1
 "Rift Zone"=2
 "Subduction Zone"= 3;
proc format ;
value $fcrust
"Crust Thickness Unknown"=0
"Continental Crust"=1
"Intermediate Crust"=2
"Oceanic Crust"=3;&lt;/PRE&gt;&lt;P&gt;When i use above code following log is displayed.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Myra22_1-1653977623323.png" style="width: 375px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71889i89851CCDBA999A63/image-dimensions/375x304?v=v2" width="375" height="304" role="button" title="Myra22_1-1653977623323.png" alt="Myra22_1-1653977623323.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Myra22_2-1653977650976.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71890i0AD8BCB0AD8519D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Myra22_2-1653977650976.png" alt="Myra22_2-1653977650976.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When i create frequency table i get the tables below followed by log&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Myra22_0-1653978244756.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71893i4801DC16D9FE2186/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Myra22_0-1653978244756.png" alt="Myra22_0-1653978244756.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Myra22_1-1653978277632.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71894i992068D84E768552/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Myra22_1-1653978277632.png" alt="Myra22_1-1653978277632.png" /&gt;&lt;/span&gt;&lt;/P&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;&lt;P&gt;Thanks everyone&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 06:24:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815757#M34246</guid>
      <dc:creator>Myra22</dc:creator>
      <dc:date>2022-05-31T06:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format :Applying custom format results in column with no values.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815763#M34247</link>
      <description>&lt;P&gt;If you create a character format then the format label also needs to be character. Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
value $fcrust
"Crust Thickness Unknown"="0"
"Continental Crust"="1"
"Intermediate Crust"="2"
"Oceanic Crust"="3";&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 May 2022 04:19:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815763#M34247</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-05-31T04:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format :Applying custom format results in column with no values.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815764#M34248</link>
      <description>&lt;P&gt;hi SasKiwi,&lt;/P&gt;&lt;P&gt;I have tried that but still not working.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 04:36:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815764#M34248</guid>
      <dc:creator>Myra22</dc:creator>
      <dc:date>2022-05-31T04:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format :Applying custom format results in column with no values.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815765#M34249</link>
      <description>&lt;P&gt;Are you sure CRUST_TYPE is character?&amp;nbsp; Perhaps it is numeric and it has some other format attached to it that is making the numbers be displayed as those strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If looks like the values have leading spaces. The ODS output you posted the photograph of does not properly display leading spaces.&amp;nbsp; &amp;nbsp;Try your PROC FREQ using the $QUOTE. format instead.&amp;nbsp; The you might be able to detect the leading spaces in the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you defined a format with a maximum width of only one character then any value that was not one of the 4 values defined in your format will essentially be printed using $1. format.&amp;nbsp; So if all four values in your actual data start with at least one leading space that could be the reason why everything shows as the same blank value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is much easier to see leading spaces in plain old text LISTING output.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input crust_type $char30.;
cards;
Crust Thickness Unknown
 Continental Crust
Intermediate Crust
 Oceanic Crust
;


proc freq data=have;
  tables crust_type;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;The FREQ Procedure

                                                    Cumulative    Cumulative
crust_type                 Frequency     Percent     Frequency      Percent
----------------------------------------------------------------------------
 Continental Crust                1       25.00             1        25.00
 Oceanic Crust                    1       25.00             2        50.00
Crust Thickness Unknown           1       25.00             3        75.00
Intermediate Crust                1       25.00             4       100.00
&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 May 2022 05:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815765#M34249</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-31T05:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format :Applying custom format results in column with no values.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815767#M34250</link>
      <description>&lt;P&gt;Please post your complete SAS log as it most likely will contain NOTEs that may help us understand what is happening.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 05:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815767#M34250</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-05-31T05:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format :Applying custom format results in column with no values.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815769#M34251</link>
      <description>&lt;P&gt;I guess you did something to the dataset between the two PROC FREQs, or used different datasets. The number of missing values is not changed by a format that does not explicitly create missing values, or reformat them to a non-missing value. Both of which your format does not do.&lt;/P&gt;
&lt;P&gt;A value not "caught" by the format would be used raw (unformatted).&lt;/P&gt;
&lt;P&gt;Run both PROC FREQs which create your outputs, and the PROC FORMAT in immediate succession, and post the complete log of all three steps.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 05:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815769#M34251</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-05-31T05:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format :Applying custom format results in column with no values.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815781#M34253</link>
      <description>Hi Tom $QUOTE. did the trick. There was a leading blank in the string . Thank you so much .</description>
      <pubDate>Tue, 31 May 2022 07:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815781#M34253</guid>
      <dc:creator>Myra22</dc:creator>
      <dc:date>2022-05-31T07:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc format :Applying custom format results in column with no values.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815790#M34255</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I guess you did something to the dataset between the two PROC FREQs, or used different datasets. The number of missing values is not changed by a format that does not explicitly create missing values, or reformat them to a non-missing value. Both of which your format does not do.&lt;/P&gt;
&lt;P&gt;A value not "caught" by the format would be used raw (unformatted).&lt;/P&gt;
&lt;P&gt;Run both PROC FREQs which create your outputs, and the PROC FORMAT in immediate succession, and post the complete log of all three steps.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;PROC FREQ will distinguish between character variables that are all blanks (what it count as missing) and those that are blank after the format is applied.&amp;nbsp; If there are no observations with a completely empty value then the formatted blanks are treated as a normal category.&amp;nbsp; If there is at least on completely empty value then all of the formatted values that print as blank are treated as missing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input crust_type $char30.;
cards;
Crust Thickness Unknown
 Continental Crust
Intermediate Crust
 Oceanic Crust

;

proc freq data=have;
  tables crust_type;
  format crust_type $1.;
run;

proc freq data=have;
  where crust_type ne ' ';
  tables crust_type;
  format crust_type $1.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1653990537595.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71896i4582E24393425ED5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1653990537595.png" alt="Tom_0-1653990537595.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And if all of the values format as blank and at least one of them is all blank you get the output from the original posting.&amp;nbsp; With an empty table section and the count of missing in the footer.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
  where crust_type =: ' ';
  tables crust_type;
  format crust_type $1.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1653990737791.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71897iF19CEEA38D52E060/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1653990737791.png" alt="Tom_0-1653990737791.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 09:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-format-Applying-custom-format-results-in-column-with-no/m-p/815790#M34255</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-31T09:52:50Z</dc:date>
    </item>
  </channel>
</rss>

