<?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: importing excel to sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119132#M24538</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Enterprise Guide can handle that conversion for you, but if you are using PROC IMPORT you will have to post-process the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If gvkey is desired to be numeric, you can use PROC DATASETS to apply a format (Z6.) to it.&lt;/P&gt;&lt;P&gt;If gvkey is actually a character string that happens to be all digits, then you will need to use a data step to convert, something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA new;&lt;/P&gt;&lt;P&gt;SET _LAST_(RENAME=(gvkey=gvkeyold));&lt;/P&gt;&lt;P&gt;LENGTH gvkey $6.;&lt;/P&gt;&lt;P&gt;gvkey=PUT(gvkeyold,Z6.);&lt;/P&gt;&lt;P&gt;DROP gvkeyold;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Apr 2013 17:20:35 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2013-04-24T17:20:35Z</dc:date>
    <item>
      <title>importing excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119131#M24537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI, all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;attached is a sample of my data. when I import into sas, gvkey &lt;BR /&gt;variable drop the initial 00 , but I need the content intact. that is &lt;BR /&gt;what I expected is a sas dataset with 001001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gvkey year index&lt;/P&gt;&lt;P&gt;001001 1983 1.005130&lt;/P&gt;&lt;P&gt;001001 1984 1.003507&lt;/P&gt;&lt;P&gt;001001 1985 1.004025&lt;/P&gt;&lt;P&gt;001003 1982 1.017350&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help! thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 15:27:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119131#M24537</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-04-24T15:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: importing excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119132#M24538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Enterprise Guide can handle that conversion for you, but if you are using PROC IMPORT you will have to post-process the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If gvkey is desired to be numeric, you can use PROC DATASETS to apply a format (Z6.) to it.&lt;/P&gt;&lt;P&gt;If gvkey is actually a character string that happens to be all digits, then you will need to use a data step to convert, something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA new;&lt;/P&gt;&lt;P&gt;SET _LAST_(RENAME=(gvkey=gvkeyold));&lt;/P&gt;&lt;P&gt;LENGTH gvkey $6.;&lt;/P&gt;&lt;P&gt;gvkey=PUT(gvkeyold,Z6.);&lt;/P&gt;&lt;P&gt;DROP gvkeyold;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 17:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119132#M24538</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2013-04-24T17:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: importing excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119133#M24539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Doc!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not have Enterprise Guide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gvkey is a charater, I formatted as text in excel, but when I use SAS- File-Import data (i.e. menu option), it drops the initial 00 from (001001) to 1001 (outcome), could you show some code that use proc import (or other methods) that will preserve the initial 00?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 16:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119133#M24539</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-04-25T16:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: importing excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119134#M24540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Doc,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code works! Sorry about my misunderstanding .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 16:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119134#M24540</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-04-25T16:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: importing excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119135#M24541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PROC IMPORT scans the Excel records to determine the data type, it does not use the Excel format.&amp;nbsp; If you don't have EGuide, the only way I know how to convert is with the DATA step mentioned earlier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 17:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119135#M24541</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2013-04-25T17:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: importing excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119136#M24542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the LIBNAME statement to access Excel files&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIBNAME XXX EXCEL "C:\TEST.XLS";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then set a length/format before reading from the selected sheet&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA TEST;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; LENGTH GVKEY $6.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SET XXX."SHEET1$"N;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That way you read it as character.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Apr 2013 12:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119136#M24542</guid>
      <dc:creator>ChrisSelley</dc:creator>
      <dc:date>2013-04-30T12:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: importing excel to sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119137#M24543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Chris!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 May 2013 15:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-excel-to-sas/m-p/119137#M24543</guid>
      <dc:creator>LanMin</dc:creator>
      <dc:date>2013-05-02T15:40:50Z</dc:date>
    </item>
  </channel>
</rss>

