<?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 Change decimal number to a character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-number-to-a-character/m-p/846003#M334450</link>
    <description>&lt;PRE&gt;data test;
num=1901012434.0000000;
num1=put(num,10);
run;&lt;/PRE&gt;
&lt;P&gt;If you run this code it correctly ends where the period is displayed.&amp;nbsp;1901012434&lt;/P&gt;
&lt;P&gt;However my dataset provides the entire number as a numeric value from the dataset.&lt;/P&gt;
&lt;P&gt;1901012434.0000000 is what is shown.&lt;/P&gt;
&lt;P&gt;1. I want to show just the first 10 numbers and&lt;/P&gt;
&lt;P&gt;2. Convert it to a character value&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2022 19:24:57 GMT</pubDate>
    <dc:creator>Q1983</dc:creator>
    <dc:date>2022-11-23T19:24:57Z</dc:date>
    <item>
      <title>Change decimal number to a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-number-to-a-character/m-p/846003#M334450</link>
      <description>&lt;PRE&gt;data test;
num=1901012434.0000000;
num1=put(num,10);
run;&lt;/PRE&gt;
&lt;P&gt;If you run this code it correctly ends where the period is displayed.&amp;nbsp;1901012434&lt;/P&gt;
&lt;P&gt;However my dataset provides the entire number as a numeric value from the dataset.&lt;/P&gt;
&lt;P&gt;1901012434.0000000 is what is shown.&lt;/P&gt;
&lt;P&gt;1. I want to show just the first 10 numbers and&lt;/P&gt;
&lt;P&gt;2. Convert it to a character value&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 19:24:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-decimal-number-to-a-character/m-p/846003#M334450</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2022-11-23T19:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change decimal number to a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-number-to-a-character/m-p/846004#M334451</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	num1 = 1901012434;
	num2 = num1;
	num3 = put(num1, 10.);

	format num1 18.7;
	format num2 10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;num1: Number shown with .0000000&lt;/P&gt;
&lt;P&gt;num2: Number shown without .0000000&lt;/P&gt;
&lt;P&gt;num3: Character variable without .0000000&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 19:36:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-decimal-number-to-a-character/m-p/846004#M334451</guid>
      <dc:creator>derekg</dc:creator>
      <dc:date>2022-11-23T19:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Change decimal number to a character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-number-to-a-character/m-p/846012#M334456</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5629"&gt;@Q1983&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;data test;
num=1901012434.0000000;
num1=put(num,10);
run;&lt;/PRE&gt;
&lt;P&gt;If you run this code it correctly ends where the period is displayed.&amp;nbsp;1901012434&lt;/P&gt;
&lt;P&gt;However my dataset provides the entire number as a numeric value from the dataset.&lt;/P&gt;
&lt;P&gt;1901012434.0000000 is what is shown.&lt;/P&gt;
&lt;P&gt;1. I want to show just the first 10 numbers and&lt;/P&gt;
&lt;P&gt;2. Convert it to a character value&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So does NOT have DECIMAL numbers.&amp;nbsp; It only has binary floating point numbers.&amp;nbsp; So&amp;nbsp;1901012434 , 1901012434.0000000 and 1,901,012,434 are all stored as the exact same binary floating value.&amp;nbsp; If they are displayed differently then you must have attached a different display FORMAT to the variable.&amp;nbsp; A FORMAT is instructions for how to display the value as text strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to display the 10 digits then attach the 10. (or if you want leading zeros then Z10.) format to the variable.&lt;/P&gt;
&lt;P&gt;If you want to convert it to a character string use the PUT() function with the format of your choice.&amp;nbsp; Watch out for character values though because there are multiple ways to store the same number as a character string.&amp;nbsp; In particular if the value is less than a billion then using 10. format will store leading spaces into the character string.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 20:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-decimal-number-to-a-character/m-p/846012#M334456</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-23T20:22:00Z</dc:date>
    </item>
  </channel>
</rss>

