<?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 Trouble importing data formatted as percent in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-importing-data-formatted-as-percent/m-p/61558#M17477</link>
    <description>I have a .csv file that I'm importing into SAS using the infile statement.  There are a few columns that have data formatted as a percent, but the percentages in the raw data don't always show 2 decimal places, so "6.00%" is writen as "6%".&lt;BR /&gt;
&lt;BR /&gt;
I'm importing the data in an infile datastep so I have the informat set at percent3.2 for those fields.  The import runs without any errors, however when I check the SAS data set the percentages without any decimal places are imported incorrectly.  &lt;BR /&gt;
&lt;BR /&gt;
For example: &lt;BR /&gt;
"6%" gets read as .0006 &lt;BR /&gt;
-but- &lt;BR /&gt;
"6.12%" gets read in correctly as .0612&lt;BR /&gt;
&lt;BR /&gt;
I need the "6%" to be read in as .06.  Any ideas how I can fix this?&lt;BR /&gt;
&lt;BR /&gt;
Sample of my code:&lt;BR /&gt;
data work.MyDataset;&lt;BR /&gt;
      %let _EFIERR_ = 0;&lt;BR /&gt;
      infile 'C:\MyFile.csv'&lt;BR /&gt;
      delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;&lt;BR /&gt;
         informat OldInterestRate percent3.2 ;&lt;BR /&gt;
         informat NewInterestRate percent3.2 ;&lt;BR /&gt;
           format OldInterestRate 10.6 ;&lt;BR /&gt;
           format NewInterestRate 10.6 ;&lt;BR /&gt;
          .....</description>
    <pubDate>Tue, 04 Aug 2009 23:49:35 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-08-04T23:49:35Z</dc:date>
    <item>
      <title>Trouble importing data formatted as percent</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-importing-data-formatted-as-percent/m-p/61558#M17477</link>
      <description>I have a .csv file that I'm importing into SAS using the infile statement.  There are a few columns that have data formatted as a percent, but the percentages in the raw data don't always show 2 decimal places, so "6.00%" is writen as "6%".&lt;BR /&gt;
&lt;BR /&gt;
I'm importing the data in an infile datastep so I have the informat set at percent3.2 for those fields.  The import runs without any errors, however when I check the SAS data set the percentages without any decimal places are imported incorrectly.  &lt;BR /&gt;
&lt;BR /&gt;
For example: &lt;BR /&gt;
"6%" gets read as .0006 &lt;BR /&gt;
-but- &lt;BR /&gt;
"6.12%" gets read in correctly as .0612&lt;BR /&gt;
&lt;BR /&gt;
I need the "6%" to be read in as .06.  Any ideas how I can fix this?&lt;BR /&gt;
&lt;BR /&gt;
Sample of my code:&lt;BR /&gt;
data work.MyDataset;&lt;BR /&gt;
      %let _EFIERR_ = 0;&lt;BR /&gt;
      infile 'C:\MyFile.csv'&lt;BR /&gt;
      delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;&lt;BR /&gt;
         informat OldInterestRate percent3.2 ;&lt;BR /&gt;
         informat NewInterestRate percent3.2 ;&lt;BR /&gt;
           format OldInterestRate 10.6 ;&lt;BR /&gt;
           format NewInterestRate 10.6 ;&lt;BR /&gt;
          .....</description>
      <pubDate>Tue, 04 Aug 2009 23:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trouble-importing-data-formatted-as-percent/m-p/61558#M17477</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-04T23:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble importing data formatted as percent</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-importing-data-formatted-as-percent/m-p/61559#M17478</link>
      <description>Here is a code example to try:&lt;BR /&gt;
&lt;BR /&gt;
39   data _null_;&lt;BR /&gt;
40   informat pctval percent.;&lt;BR /&gt;
41   format pctval percent7.2;&lt;BR /&gt;
42   input pctval ;&lt;BR /&gt;
43   putlog _all_;&lt;BR /&gt;
44   datalines;&lt;BR /&gt;
&lt;BR /&gt;
pctval=6.22% _ERROR_=0 _N_=1&lt;BR /&gt;
pctval=6.00% _ERROR_=0 _N_=2&lt;BR /&gt;
NOTE: DATA statement used &lt;SNIP&gt;&lt;BR /&gt;
47   run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/SNIP&gt;</description>
      <pubDate>Wed, 05 Aug 2009 00:55:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trouble-importing-data-formatted-as-percent/m-p/61559#M17478</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-05T00:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble importing data formatted as percent</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Trouble-importing-data-formatted-as-percent/m-p/61560#M17479</link>
      <description>I figured it out...guess I just needed a break from it for awhile.  If I change the informat from percent3.2 to percent3.  (dropping the 2) it appears to work fine.</description>
      <pubDate>Wed, 05 Aug 2009 01:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Trouble-importing-data-formatted-as-percent/m-p/61560#M17479</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-05T01:02:01Z</dc:date>
    </item>
  </channel>
</rss>

