<?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: proc import issue with data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605063#M175505</link>
    <description>&lt;P&gt;According to documentation there is no NAMEROW statement.&lt;/P&gt;
&lt;P&gt;I have not used mutch the proc import but you may try:&lt;/P&gt;
&lt;P&gt;Cancel the namerow in your code.&lt;/P&gt;
&lt;P&gt;May be the procedure read the names from datarow - 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Nov 2019 15:53:04 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2019-11-18T15:53:04Z</dc:date>
    <item>
      <title>proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604909#M175431</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I am trying to import this short data and I am unsuccessful with this code. Can anyone help me to import the data either proc import or any other way?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc import datafile="C:\newfolder\class.csv"&lt;BR /&gt;out=check&lt;BR /&gt;dbms=csv&lt;BR /&gt;replace;&lt;BR /&gt;getnames=yes;&lt;BR /&gt;namerow=4;&lt;BR /&gt;datarow=5;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 09:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604909#M175431</guid>
      <dc:creator>buddha_d</dc:creator>
      <dc:date>2019-11-18T09:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604911#M175432</link>
      <description>&lt;P&gt;Is there a way to get the date stamp from the file?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 09:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604911#M175432</guid>
      <dc:creator>buddha_d</dc:creator>
      <dc:date>2019-11-18T09:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604915#M175434</link>
      <description>&lt;P&gt;What do you mean by "&lt;SPAN&gt;I am unsuccessful with this code" ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Are there error or warning messages in the log?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please post your log using the {i} icon.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 10:03:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604915#M175434</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-11-18T10:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604932#M175441</link>
      <description>&lt;P&gt;Shmuel,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sorry for not posting the log. please check the attachment&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 11:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604932#M175441</guid>
      <dc:creator>buddha_d</dc:creator>
      <dc:date>2019-11-18T11:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604940#M175448</link>
      <description>&lt;P&gt;Please do &lt;FONT size="5"&gt;&lt;STRONG&gt;NOT&lt;/STRONG&gt;&lt;/FONT&gt; post pictures of logs embedded in Word documents. Just copy/paste the log into a window opened with the {i} button.&lt;/P&gt;
&lt;P&gt;I suggest you follow Maxim 1 and study the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=proc&amp;amp;docsetTarget=n1qn5sclnu2l9dn1w61ifw8wqhts.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;documentation for proc import&lt;/A&gt;. There is no namerow statement.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 11:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/604940#M175448</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-18T11:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605052#M175501</link>
      <description>&lt;P&gt;Thanks Kurt. I checked the link and you are right. I am posting the log now. I could get the data imported using infile statement. But, could you point me anyway, I could get the date stamp from the file??&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;1
2    proc import datafile="C:\Daya\class.csv"
3                out=check
4                dbms=csv
5                replace;
NOTE: The previous statement has been deleted.
NOTE: The previous statement has been deleted.
6                getnames=yes;
7                namerow=4;
                 -------
                 180
ERROR 180-322: Statement is not valid or it is used out of proper order.

8                datarow=5;
9    run;


NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.06 seconds
      cpu time            0.03 seconds
&lt;BR /&gt;&lt;BR /&gt;
&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Nov 2019 15:31:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605052#M175501</guid>
      <dc:creator>buddha_d</dc:creator>
      <dc:date>2019-11-18T15:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605063#M175505</link>
      <description>&lt;P&gt;According to documentation there is no NAMEROW statement.&lt;/P&gt;
&lt;P&gt;I have not used mutch the proc import but you may try:&lt;/P&gt;
&lt;P&gt;Cancel the namerow in your code.&lt;/P&gt;
&lt;P&gt;May be the procedure read the names from datarow - 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 15:53:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605063#M175505</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-11-18T15:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605065#M175507</link>
      <description>&lt;P&gt;A csv file has, by definition, the column names in the first row.&lt;/P&gt;
&lt;P&gt;If that is not the case, you will need to write your own data step where you manually set the column names and attributes and skip the first four lines with a subsetting if.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 15:55:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605065#M175507</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-18T15:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605105#M175530</link>
      <description>&lt;P&gt;The csv file looks something like this (making allowances that the Forum makes CSV Excel for download )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Report run date and time : 10FEB14 00:00,,,,
,,,,
,,,,
name,sex,age,height,weight
Alfred ,M ,14,69,112.5
Alice ,F ,13,56.5,84
Barbara ,F ,13,65.3,98
Carol ,F ,14,62.8,102.5
Henry ,M ,14,63.5,102.5
James ,M ,12,57.3,83
Jane ,F ,12,59.8,84.5
Janet ,F ,15,62.5,112.5
Jeffrey ,M ,13,62.5,84
John ,M ,12,59,99.5
Joyce ,F ,11,51.3,50.5
Judy ,F ,14,64.3,90
Louise ,F ,12,56.3,77
Mary ,F ,15,66.5,112
Philip ,M ,16,72,150
Robert ,M ,12,64.8,128
Ronald ,M ,15,67,133
Thomas ,M ,11,57.5,85
William ,M ,15,66.5,112
&lt;/PRE&gt;
&lt;P&gt;So the appropriate solution might be&lt;/P&gt;
&lt;P&gt;1) use proc import with the correct DATAROW option to read the body of the data&lt;/P&gt;
&lt;P&gt;2) copy the generated text of data step used to read the body of the data&lt;/P&gt;
&lt;P&gt;3) Edit the infile statement generated NOT to skip to row 5 but instead&lt;/P&gt;
&lt;P&gt;4) write a parsing statement to execute a read of the first line to find that datestamp, keep it&lt;/P&gt;
&lt;P&gt;And then skip to reading the remaining data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   infile datalines dlm=',';
   informat datestamp anydtdtm20.;
   format datestamp datetime20.;
   retain datestamp;
   informat name $10. sex $1. age height weight f5.;
   
   input @;
   if _infile_ =: "Report run date and time" then
      input @28 datestamp
      /
      /
      /
      ;

   else do;
     input name sex age heigh weight;
     output;
   end;
datalines;
Report run date and time : 10FEB14 00:00,,,,
,,,,
,,,,
name,sex,age,height,weight
Alfred ,M ,14,69,112.5
Alice ,F ,13,56.5,84
Barbara ,F ,13,65.3,98
Carol ,F ,14,62.8,102.5
Henry ,M ,14,63.5,102.5
James ,M ,12,57.3,83
Jane ,F ,12,59.8,84.5
Janet ,F ,15,62.5,112.5
Jeffrey ,M ,13,62.5,84
John ,M ,12,59,99.5
Joyce ,F ,11,51.3,50.5
Judy ,F ,14,64.3,90
Louise ,F ,12,56.3,77
Mary ,F ,15,66.5,112
Philip ,M ,16,72,150
Robert ,M ,12,64.8,128
Ronald ,M ,15,67,133
Thomas ,M ,11,57.5,85
William ,M ,15,66.5,112
;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Nov 2019 17:03:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605105#M175530</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-18T17:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: proc import issue with data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605111#M175535</link>
      <description>&lt;P&gt;Thanks ballardw. It works well now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 17:13:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-import-issue-with-data/m-p/605111#M175535</guid>
      <dc:creator>buddha_d</dc:creator>
      <dc:date>2019-11-18T17:13:28Z</dc:date>
    </item>
  </channel>
</rss>

