<?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 How to find the row in excel with wrong Data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-row-in-excel-with-wrong-Data/m-p/785692#M250784</link>
    <description>&lt;P&gt;I have an excel file that I'm importing into SAS using proc import.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc import datafile="Transactions_Details_Sample_Test.xlsx" out=Transaction_dump dbms=xlsx replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assume the excel file has 1000 rows with below columns&lt;/P&gt;&lt;P&gt;Employee Name(Char Data) | NIN Number (Number Data) | Enrollment Date (Date Data)&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Issue I'm facing&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if someone enters the character data even by mistake or typo into the 1000th row of excel of the&amp;nbsp;&lt;STRONG&gt;NIN Number&lt;/STRONG&gt; column, the SAS will treat it as a character column, and all the numeric operations will fail. How can I write code in SAS to always treat it as a numeric column and to find that character data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same issue is with date, is by typo someone enters Jann-2021 instead of Jan-2021 the SAS will treat it as a character column instead of numeric date column and all the data will be messed up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is a sample of data, the last row has type errors that can change the data type of column in SAS. with millions of rows, I want to find such errors in my code.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Dec 2021 08:05:46 GMT</pubDate>
    <dc:creator>Azeem112</dc:creator>
    <dc:date>2021-12-13T08:05:46Z</dc:date>
    <item>
      <title>How to find the row in excel with wrong Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-row-in-excel-with-wrong-Data/m-p/785692#M250784</link>
      <description>&lt;P&gt;I have an excel file that I'm importing into SAS using proc import.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc import datafile="Transactions_Details_Sample_Test.xlsx" out=Transaction_dump dbms=xlsx replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assume the excel file has 1000 rows with below columns&lt;/P&gt;&lt;P&gt;Employee Name(Char Data) | NIN Number (Number Data) | Enrollment Date (Date Data)&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Issue I'm facing&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if someone enters the character data even by mistake or typo into the 1000th row of excel of the&amp;nbsp;&lt;STRONG&gt;NIN Number&lt;/STRONG&gt; column, the SAS will treat it as a character column, and all the numeric operations will fail. How can I write code in SAS to always treat it as a numeric column and to find that character data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same issue is with date, is by typo someone enters Jann-2021 instead of Jan-2021 the SAS will treat it as a character column instead of numeric date column and all the data will be messed up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is a sample of data, the last row has type errors that can change the data type of column in SAS. with millions of rows, I want to find such errors in my code.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 08:05:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-row-in-excel-with-wrong-Data/m-p/785692#M250784</guid>
      <dc:creator>Azeem112</dc:creator>
      <dc:date>2021-12-13T08:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the row in excel with wrong Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-row-in-excel-with-wrong-Data/m-p/785693#M250785</link>
      <description>&lt;P&gt;To avoid the guessing of PROC IMPORT, save the spreadsheet to a csv file and read that with a data step written by yourself; add code to detect input errors (automatic _ERROR_ variable).&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 08:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-row-in-excel-with-wrong-Data/m-p/785693#M250785</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-12-13T08:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the row in excel with wrong Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-row-in-excel-with-wrong-Data/m-p/785696#M250786</link>
      <description>&lt;P&gt;If I export that into CSV and there is any comma in the name, it's gonna mess up.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 09:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-row-in-excel-with-wrong-Data/m-p/785696#M250786</guid>
      <dc:creator>Azeem112</dc:creator>
      <dc:date>2021-12-13T09:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the row in excel with wrong Data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-row-in-excel-with-wrong-Data/m-p/785722#M250789</link>
      <description>&lt;P&gt;Excel uses semicolons in csv exports, and puts quotes around values that contain delimiters. The DSD option in the INFILE statement will honor that.&lt;/P&gt;
&lt;P&gt;See the attached Excel and csv file.&lt;/P&gt;
&lt;P&gt;I read the csv and print the dataset with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile "~/test.csv" dlm=";" dsd truncover;
input name :$20. data $ number;
run;

proc print data=test;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;giving this result:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;Beob.	name	data	number
1	name,name	xxx	1
2	name;name	yyy	2&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 10:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-row-in-excel-with-wrong-Data/m-p/785722#M250789</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-12-13T10:17:32Z</dc:date>
    </item>
  </channel>
</rss>

