<?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: How to format the numeric values of a column except the missing values (9999 and 0) in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/510948#M2060</link>
    <description>What is survey32.?</description>
    <pubDate>Wed, 07 Nov 2018 03:50:13 GMT</pubDate>
    <dc:creator>d6k5d3</dc:creator>
    <dc:date>2018-11-07T03:50:13Z</dc:date>
    <item>
      <title>How to format the numeric values of a column except the missing values (9999 and 0)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508167#M1613</link>
      <description>&lt;P&gt;I have a dataset which has initially&amp;nbsp; got CHAR values in one of its columns. Also there are '--' and bank spaces. I would like to denote '--' as 9999 and complete bank spaces as 0. And then I want to conditionally format the remaining values: from CHAR to numeric. Here's my code. But the code converts all 9999s and 0s too. Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import datafile='C:\...\EU_ER.csv'&lt;BR /&gt;dbms=csv replace out=eu_er;&lt;BR /&gt;getnames=yes;&lt;BR /&gt;guessingrows=max;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data eu_er;&lt;BR /&gt;set eu_er;&lt;BR /&gt;if Surv_M='--' then Surv_M=9999;&lt;BR /&gt;if Surv_M=' ' then Surv_M=0;&lt;BR /&gt;&lt;BR /&gt;SurvM=input(Surv_M, best32.);&lt;BR /&gt;if SurvM ^= 9999 OR SurvM ^= 0 then do;&lt;BR /&gt;format SurvM 32.4;&lt;BR /&gt;end;&lt;BR /&gt;drop Surv_M;&lt;BR /&gt;rename SurvM=Surv_M;&lt;BR /&gt;run;&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="2.PNG" style="width: 324px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24443iC2C2B2F9BE309221/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 21:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508167#M1613</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-10-28T21:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the numeric values of a column except the missing values (9999 and 0)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508168#M1614</link>
      <description>&lt;P&gt;format is a compile time statement and not at execution time statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;associating a format to a variable is one thing while using a format(in a put function at execution time) assigning the formatted values for the new char/&lt;STRIKE&gt;num var&lt;/STRIKE&gt; respectively is another thing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 21:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508168#M1614</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-28T21:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the numeric values of a column except the missing values (9999 and 0)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508169#M1615</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;, what solution would like to suggest? Much thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 21:38:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508169#M1615</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-10-28T21:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the numeric values of a column except the missing values (9999 and 0)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508176#M1621</link>
      <description>&lt;P&gt;Sure if you could provide us a sample data that we can copy paste to our sas environment, and your required output for the input sample, one of us in the community will provide you the code tested using the sample you give us plz&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mention your requirement logic in a couple of sentences along with your sample than pics&lt;/P&gt;</description>
      <pubDate>Sun, 28 Oct 2018 21:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508176#M1621</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-28T21:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the numeric values of a column except the missing values (9999 and 0)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508217#M1630</link>
      <description>&lt;P&gt;Why would you want to convert your MISSING values into valid numbers?&amp;nbsp; That would make it impossible for SAS to know that it shouldn't use those values when calculating mean,min,max etc for your variable?&amp;nbsp; Leave them as MISSING values.&amp;nbsp; You can use special missing values if you want to distinguish between hyphens and blanks.&lt;/P&gt;
&lt;P&gt;Here is code that converts the blanks into missing and hyphens into the special missing .A.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data eu_er_fixed;
  set eu_er;
  length Surv_M_number 8;
  format Suv_M_number 32.4 ;
  if Surv_M='--' then Surv_M_number=.a;
  else if Surv_M=' ' then Surv_M_number=.;
  else Surv_M_number = input(Surv_M,32.);
  drop Surv_M;
  rename Surv_M_number=Surv_M;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Formats are rules for converting values into text. Informats are rules for converting text into values.&lt;/P&gt;
&lt;P&gt;You might be able to make this easier with a user defined informat.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
  invalue survey '--'=.a ' '=. ;
run;
data eu_er_fixed;
  set eu_er;
  length Surv_M_number 8;
  format Suv_M_number 32.4 ;
  Surv_M_number = input(Surv_M,survey32.);
  drop Surv_M;
  rename Surv_M_number=Surv_M;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2018 02:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/508217#M1630</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-10-29T02:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the numeric values of a column except the missing values (9999 and 0)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/510948#M2060</link>
      <description>What is survey32.?</description>
      <pubDate>Wed, 07 Nov 2018 03:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/510948#M2060</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2018-11-07T03:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to format the numeric values of a column except the missing values (9999 and 0)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/511014#M2078</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/239423"&gt;@d6k5d3&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;What is survey32.?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The specification for what INFORMAT to use with the INPUT() function call.&amp;nbsp; It was defined in the PROC FORMAT step.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 13:08:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-format-the-numeric-values-of-a-column-except-the-missing/m-p/511014#M2078</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-07T13:08:36Z</dc:date>
    </item>
  </channel>
</rss>

