<?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: How to have proc import use column headings located in row-2? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178035#M264880</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would be nice if the Filename statement supported the FIRSTOBS= option.&amp;nbsp; Then you would not need to data _null_ step.&lt;/P&gt;&lt;P&gt;(No offense!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 May 2014 01:35:50 GMT</pubDate>
    <dc:creator>RichardinOz</dc:creator>
    <dc:date>2014-05-30T01:35:50Z</dc:date>
    <item>
      <title>How to have proc import use column headings located in row-2?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178031#M264876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have a utility that creates a large number of CSV files. The utility puts the type of data in that CSV file in row-1 (for example: 'PDEVINFO' or 'LDEVINFO') and the column headings are in row-2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc import&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; datafile = 'where it is'&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; out=Work.PDEVINFO&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; dbms = csv;&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; getnames = yes;&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; datarow = 3;&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; guessrows = 1000;&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;proc print data=Work.PDEVINFO uniform;&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;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What it is doing is getting the value 'PDEVINFO' from row-1 and treating that as a column header and then all other columns it generates variable names as&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR1, VAR2,....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a simple way of telling it to get the column headings from row-2?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 22:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178031#M264876</guid>
      <dc:creator>lloydc</dc:creator>
      <dc:date>2014-05-29T22:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to have proc import use column headings located in row-2?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178032#M264877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One solution is to remove the first line before Proc Import.&amp;nbsp; It means that the files get read twice, which for many large files can be an issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename have '&amp;lt;existing CSV&amp;gt;' ;&lt;/P&gt;&lt;P&gt;filename want '&amp;lt;edited CSV&amp;gt;' ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _Null_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _N_ = 1 then return ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put _infile_ ;&lt;/P&gt;&lt;P&gt;Run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using base SAS rather then EG it is possible to do a Proc Import, then press F4 to retrieve the submitted code (which is just a SAS datastep) and edit it to skip the first line.&amp;nbsp; Then use the edited datastep instead of Proc Import.&amp;nbsp; Only worth doing if all your files have the same layout and column names, and the layout/names are unlikely to change..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 23:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178032#M264877</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2014-05-29T23:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to have proc import use column headings located in row-2?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178033#M264878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, you probably will need to set LRECL= 9999 or some large number on the filename statements to avoid truncation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 23:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178033#M264878</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2014-05-29T23:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to have proc import use column headings located in row-2?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178034#M264879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use FIRSTOBS=2 on the INFILE statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 23:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178034#M264879</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-05-29T23:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to have proc import use column headings located in row-2?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178035#M264880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would be nice if the Filename statement supported the FIRSTOBS= option.&amp;nbsp; Then you would not need to data _null_ step.&lt;/P&gt;&lt;P&gt;(No offense!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 01:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178035#M264880</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2014-05-30T01:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to have proc import use column headings located in row-2?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178036#M264881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fortunately these files are fairly small, just a couple of thousand records. This solution worked for me, thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 03:23:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178036#M264881</guid>
      <dc:creator>lloydc</dc:creator>
      <dc:date>2014-05-30T03:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to have proc import use column headings located in row-2?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178037#M264882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You did remember to remove&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'courier new', courier; font-size: 12.800000190734863px; background-color: #ffffff;"&gt;datarow = 3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;didn't you?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 04:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-have-proc-import-use-column-headings-located-in-row-2/m-p/178037#M264882</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2014-05-30T04:12:11Z</dc:date>
    </item>
  </channel>
</rss>

