<?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: Read packed decimal values and write it in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200777#M266786</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom, &lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Its working fine. But, if value is .25 in input dataset, then I am getting output with leading zero i.e 0.25. How to remove the zero from that field in output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Aug 2015 16:51:58 GMT</pubDate>
    <dc:creator>Santhoshcsc</dc:creator>
    <dc:date>2015-08-19T16:51:58Z</dc:date>
    <item>
      <title>Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200771#M266780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to read some non-readable values from a dataset and write it as numeric field. But I am not getting the exact output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field legth in inputfile is 5 bytes. and non-readable format.In output, I need to write the same as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;Field length should be 13 bytes with two decimal points and with leading spaces:&lt;/P&gt;&lt;P&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01.50'&lt;/P&gt;&lt;P&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13.62'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100.21'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 81.1'&lt;/P&gt;&lt;P&gt;Please help me. I am new to SAS and handling packed decimal values for first time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 16:37:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200771#M266780</guid>
      <dc:creator>Santhoshcsc</dc:creator>
      <dc:date>2015-08-17T16:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200772#M266781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are you trying to read from (CSV, TXT, DB) and how did you read it, what was your code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 17:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200772#M266781</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-08-17T17:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200773#M266782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to read from a flat file in mainframes. Fields are in fixed positions.&lt;/P&gt;&lt;P&gt;Input File:&lt;/P&gt;&lt;P&gt;Data ifile;&lt;/P&gt;&lt;P&gt;@01 Name $8.&lt;/P&gt;&lt;P&gt;@09 Age 02.&lt;/P&gt;&lt;P&gt;@11 Appthrs pd 5.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;Johhny 25 $@%%^&lt;/P&gt;&lt;P&gt;David&amp;nbsp; 54 *&amp;amp;$#@&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;date ofile:&lt;/P&gt;&lt;P&gt;set ifile;&lt;/P&gt;&lt;P&gt;format appthrs pd5;&lt;/P&gt;&lt;P&gt;Put&lt;/P&gt;&lt;P&gt;@01 Name $8.&lt;/P&gt;&lt;P&gt;@09 Age 02.&lt;/P&gt;&lt;P&gt;@11 Appthrs 13.2.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expected output:&lt;/P&gt;&lt;P&gt;Johhny 25 12.21&lt;/P&gt;&lt;P&gt;David&amp;nbsp; 54 05.50&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 17:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200773#M266782</guid>
      <dc:creator>Santhoshcsc</dc:creator>
      <dc:date>2015-08-17T17:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200774#M266783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your last value does not display two decimals.&lt;/P&gt;&lt;P&gt;Also what is your target destination. I would assume text but ...&lt;/P&gt;&lt;P&gt;And should the output be actually quoted or was that just to show the leading spaces?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If writing to text then an F13.2 format should work unless you actually need the quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the input looked like 10021 and needs to be read as 100.21 then an input format of F5.2 would work. Put to assign an input format you'll need to use a data step.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 17:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200774#M266783</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-08-17T17:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200775#M266784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you really have PD data with two decimal points then you should use a program like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data have ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; infile 'source data file' ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; file 'new source data file' ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input name $8. age 2. appthrs S370FPD5.2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put name $8. age 2. appthrs 13.2 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;If you data really has values like you presented then the PD format for those values would look like these HEX codes.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;x=1.5&amp;nbsp;&amp;nbsp;&amp;nbsp; y=000000150C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;x=13.62&amp;nbsp; y=000001362C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;x=100.21 y=000010021C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;x=81.1&amp;nbsp;&amp;nbsp; y=000008110C&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 19:00:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200775#M266784</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-17T19:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200776#M266785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The links in this post could be useful:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="active_link" href="https://communities.sas.com/message/30631#30631"&gt;https://communities.sas.com/message/30631#30631&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 19:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200776#M266785</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-08-17T19:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200777#M266786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom, &lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Its working fine. But, if value is .25 in input dataset, then I am getting output with leading zero i.e 0.25. How to remove the zero from that field in output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 16:51:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200777#M266786</guid>
      <dc:creator>Santhoshcsc</dc:creator>
      <dc:date>2015-08-19T16:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200778#M266787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also is this IMPLIED decimals, which is just showing the number without a decimal point and is assumed to be in a certain location or actual packed decimal which is a specific form of encoding data in binary values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 17:43:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200778#M266787</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-08-19T17:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200779#M266788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Why would you NOT want the zero before the decimal place? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;SAS does not really support that format directly, but you could perhaps build your own.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc format ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; picture nozero&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; low- -1='000000000.99' (prefix='-')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; -1-&amp;lt;0 = '99' (prefix='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -.' multiplier=100)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; 0-1 = '99' (prefix='&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .' multiplier=100)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; 1-high='0000000000.99'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; input x @@;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put x 13.2 +1&amp;nbsp; x nozero.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;-1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;1.3 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;0.34 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;0.25 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;-.24 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;1.24 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;;;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1.00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1.00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.34&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .34&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .25&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -.24&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.24&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .00&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2015 18:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200779#M266788</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-19T18:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Read packed decimal values and write it</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200780#M266789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much.. It worked well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Aug 2015 16:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-packed-decimal-values-and-write-it/m-p/200780#M266789</guid>
      <dc:creator>Santhoshcsc</dc:creator>
      <dc:date>2015-08-21T16:31:52Z</dc:date>
    </item>
  </channel>
</rss>

