<?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 Converting Numeric field to Character field without losing the precision in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Numeric-field-to-Character-field-without-losing-the/m-p/513497#M15972</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently working in DiStudio and am reading in a SAS dataset that has a numeric value. I'm trying to create a 'verification' job that looks to see the number of digits before and after the decimal and flag any that are not accurate. I've done this before, but the field was a character field and not numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, we have a table of values and the ones that appear in a numeric column are as follows:&lt;/P&gt;&lt;P&gt;1.1230&lt;/P&gt;&lt;P&gt;1.784&lt;/P&gt;&lt;P&gt;1.1487&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We want to find all decimals without four decimals (ie 1.784) However, when I do (LENGTH(SCAN(PUT(X,best.),2,'.')) ^= 4, it flags both 1.784 and 1.1230 since best drops the trailing zero.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Would somebody be able to help me figure out how I can find the digits after the decimal place in the WHERE tab of DiStudio?&lt;/P&gt;</description>
    <pubDate>Thu, 15 Nov 2018 18:10:25 GMT</pubDate>
    <dc:creator>sbrighenti</dc:creator>
    <dc:date>2018-11-15T18:10:25Z</dc:date>
    <item>
      <title>Converting Numeric field to Character field without losing the precision</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Numeric-field-to-Character-field-without-losing-the/m-p/513497#M15972</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently working in DiStudio and am reading in a SAS dataset that has a numeric value. I'm trying to create a 'verification' job that looks to see the number of digits before and after the decimal and flag any that are not accurate. I've done this before, but the field was a character field and not numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, we have a table of values and the ones that appear in a numeric column are as follows:&lt;/P&gt;&lt;P&gt;1.1230&lt;/P&gt;&lt;P&gt;1.784&lt;/P&gt;&lt;P&gt;1.1487&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We want to find all decimals without four decimals (ie 1.784) However, when I do (LENGTH(SCAN(PUT(X,best.),2,'.')) ^= 4, it flags both 1.784 and 1.1230 since best drops the trailing zero.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Would somebody be able to help me figure out how I can find the digits after the decimal place in the WHERE tab of DiStudio?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 18:10:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Numeric-field-to-Character-field-without-losing-the/m-p/513497#M15972</guid>
      <dc:creator>sbrighenti</dc:creator>
      <dc:date>2018-11-15T18:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Numeric field to Character field without losing the precision</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Numeric-field-to-Character-field-without-losing-the/m-p/513532#M15973</link>
      <description>&lt;P&gt;Don't convert to numeric, extract the number before and after decimal and find the length for that characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length(strip(scan(val,1,'.')))=1 and  length(strip(scan(val,2,'.')))=3&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Nov 2018 19:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Numeric-field-to-Character-field-without-losing-the/m-p/513532#M15973</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-11-15T19:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Numeric field to Character field without losing the precision</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Numeric-field-to-Character-field-without-losing-the/m-p/513578#M15974</link>
      <description>&lt;P&gt;Also you can try perl regular expression for this type of matching.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;prxmatch("/^\d{1}\.\d{3}$/",strip(val))=1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;^&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- Beginning&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;\d{1}&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/STRONG&gt; - one digit&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;\.&lt;/STRONG&gt; (\dot)&amp;nbsp; - escape special character { &lt;STRONG&gt;.&lt;/STRONG&gt; }&amp;nbsp;&lt;/P&gt;
&lt;P&gt;\d{3}&amp;nbsp; &amp;nbsp; &amp;nbsp; - 3 digits&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;$&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;- End of line&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 20:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Numeric-field-to-Character-field-without-losing-the/m-p/513578#M15974</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-11-15T20:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Numeric field to Character field without losing the precision</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Converting-Numeric-field-to-Character-field-without-losing-the/m-p/513819#M15978</link>
      <description>&lt;P&gt;Once you've read the source string into a numerical variable there is no telling if the source string was 1.2 or 1.2000&lt;/P&gt;
&lt;P&gt;It's numerically the same and will be stored internally the same. It has nothing to do with formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To check the digits of the source string you need to read the data as character. With DIS you can do so by defining a character informat for the External File Metadata. After that use the same approach as in the past. You can always later on convert the character variable to a numeric one via an expression like input(&amp;lt;charvar&amp;gt;, best32.)&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 08:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Converting-Numeric-field-to-Character-field-without-losing-the/m-p/513819#M15978</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-11-16T08:54:13Z</dc:date>
    </item>
  </channel>
</rss>

