<?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: list of &amp;quot;eject&amp;quot; line after proc import in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450698#M29139</link>
    <description>&lt;P&gt;Here is a brief example of sending data to a "baddata" set when encountering errors in reading the data:&lt;/P&gt;
&lt;PRE&gt;data gooddata (keep=number) baddata (keep=str line);
   length str $ 50.;
   input number;
   if _error_ then do;
      str=_infile_;
      line=_n_;
      output baddata;
   end;
   else output gooddata;
datalines;
1
234
45-789
(123456)
1E27
;
run;
&lt;/PRE&gt;
&lt;P&gt;If SAS has any read error then it sets an internal variable named _error_ to 1(or true) so you can test if a read error occurred if you test immediately after an input statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS also maintains another variable, _infile_ that has the contents of an entire line of data being read. The special variable _n_ is the iteration of the data step and can be used in many cases as a "line" counter.&lt;/P&gt;
&lt;P&gt;So 1) create a string variable long enough to hold the longest line of data 2) test if there was a read error, 3) if an error send to the bad data set, of not the good set. Note that OUTPUT with a data set name is used to&amp;nbsp;when data goes to which data set, the KEEP (or a DROP data set option) indicates which variables are in which data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that I included 1E27 as a valid numeric in scientific notation just for fun.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you source data contains things that would normally be invalid for a specified data value such as NULL or N/A for a numeric or 99999999 for a date&amp;nbsp;but you don't want them to get flagged with this process then create custom informats that assign an appropriate value (likely MISSING)&lt;/P&gt;</description>
    <pubDate>Tue, 03 Apr 2018 15:12:25 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-04-03T15:12:25Z</dc:date>
    <item>
      <title>list of "eject" line after proc import</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450646#M29136</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested a proc import under SAs with a CSV file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A numeric column contains several errors. For exemple a column of integer like "123456" , but there is unauthorized caracterse like "123-456" or "(123456)" .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import DATAfile="\\serveur\dossier\fichier.csv" DBMS=csv OUTFILE=work.import REPLACE; 
GETNAMES=no; 
guessingrows=32767; 
DELIMITER=";"; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I compare the situation with Access. With Acces when we import data and there is a error , a table is created with the meam key of the line , to inform about the anomaly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With SAS it's possible to found a list with all line which are not accepted by system ? If it's possible with the log , because by moment it's not possible to see all line , only a part ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help .&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 14:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450646#M29136</guid>
      <dc:creator>azertyuiop</dc:creator>
      <dc:date>2018-04-03T14:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: list of "eject" line after proc import</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450669#M29137</link>
      <description>&lt;P&gt;Not without some effort.&amp;nbsp; I believe it has been mentioned many times before, proc import is a&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;guessing procedure&lt;/STRONG&gt;&lt;/U&gt;.&amp;nbsp; It does a quick scan of the file and tried to guess what that data is.&amp;nbsp; It is not a good production environment process as each run can be different.&amp;nbsp; If you are receiving data, then there should be an import agreement, or at least a data definition with the data otherwise the data and hence the process is worthless.&amp;nbsp; Write a datastep program which imports the data per the spec, e.g. if the spec states that field is numeric and you get 123-456, then the spec is incorrect - and it is not your task to correct others mistakes.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could of course have a quality check if you so choose (of course at your expense and time).&amp;nbsp; Read the variables all as large character fields - character can read in anything.&amp;nbsp; Then run some code on this which checks the data, i.e. you could do:&lt;/P&gt;
&lt;PRE&gt;if lengthn(compress(var,"+-","d")) &amp;gt; 0 then flag=1;&lt;/PRE&gt;
&lt;P&gt;I.e. if the text contains anything not convertible to numeric then flag (note you can do this many ways!).&lt;/P&gt;
&lt;P&gt;But why, draw up agreements or get specs in place up front, this clarifies, simplifies and documents the transfer of data.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 14:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450669#M29137</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-03T14:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: list of "eject" line after proc import</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450670#M29138</link>
      <description>&lt;P&gt;Check the code in the log against your Access type/column list. You can see where it's guessing wrong and correct it there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165260"&gt;@azertyuiop&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tested a proc import under SAs with a CSV file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A numeric column contains several errors. For exemple a column of integer like "123456" , but there is unauthorized caracterse like "123-456" or "(123456)" .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import DATAfile="\\serveur\dossier\fichier.csv" DBMS=csv OUTFILE=work.import REPLACE; 
GETNAMES=no; 
guessingrows=32767; 
DELIMITER=";"; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I compare the situation with Access. With Acces when we import data and there is a error , a table is created with the meam key of the line , to inform about the anomaly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With SAS it's possible to found a list with all line which are not accepted by system ? If it's possible with the log , because by moment it's not possible to see all line , only a part ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help .&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 14:46:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450670#M29138</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-03T14:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: list of "eject" line after proc import</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450698#M29139</link>
      <description>&lt;P&gt;Here is a brief example of sending data to a "baddata" set when encountering errors in reading the data:&lt;/P&gt;
&lt;PRE&gt;data gooddata (keep=number) baddata (keep=str line);
   length str $ 50.;
   input number;
   if _error_ then do;
      str=_infile_;
      line=_n_;
      output baddata;
   end;
   else output gooddata;
datalines;
1
234
45-789
(123456)
1E27
;
run;
&lt;/PRE&gt;
&lt;P&gt;If SAS has any read error then it sets an internal variable named _error_ to 1(or true) so you can test if a read error occurred if you test immediately after an input statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS also maintains another variable, _infile_ that has the contents of an entire line of data being read. The special variable _n_ is the iteration of the data step and can be used in many cases as a "line" counter.&lt;/P&gt;
&lt;P&gt;So 1) create a string variable long enough to hold the longest line of data 2) test if there was a read error, 3) if an error send to the bad data set, of not the good set. Note that OUTPUT with a data set name is used to&amp;nbsp;when data goes to which data set, the KEEP (or a DROP data set option) indicates which variables are in which data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that I included 1E27 as a valid numeric in scientific notation just for fun.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you source data contains things that would normally be invalid for a specified data value such as NULL or N/A for a numeric or 99999999 for a date&amp;nbsp;but you don't want them to get flagged with this process then create custom informats that assign an appropriate value (likely MISSING)&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 15:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450698#M29139</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-03T15:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: list of "eject" line after proc import</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450968#M29147</link>
      <description>&lt;P&gt;Hello , Good morning ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't think that it's possible to build a system with 2 tables. I did think that it's necessary to find a table like the table "vcolumn" which own all information about all table under current SAS session.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will adapt the system that you propose with a proc import.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 08:26:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/list-of-quot-eject-quot-line-after-proc-import/m-p/450968#M29147</guid>
      <dc:creator>azertyuiop</dc:creator>
      <dc:date>2018-04-04T08:26:58Z</dc:date>
    </item>
  </channel>
</rss>

