<?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 data from external files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262346#M51189</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are using locale specific month names. SAS can deal with this kind of date when you set the LOCALE= system option accordingly and use one of the NL... date informats. It looks liek that for dutch SAS expects the month abreviation as mrt. instead of just mrt as in your example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is some code to illustrate this. So if you can get the dates in a locale independent format, everything would be a lot easier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options locale=nl_NL ;
data want;
  infile cards dlm=";";
  input
    detail_kind_of_document : $32.
    date_treated	: $32.
  ;
  someDate = "01mar2016"d;
  date_treated_n = input(date_treated, nldate20.);
  format date_treated_n ddmmyyp10.;
  format someDate NLDATEL12.;
cards4;
details_1;18/mrt./16
details_2;29/jul/15
details_3;08/dec/15
details_4;30/jun/15
details_5;24/mrt/16
;;;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2016 09:34:26 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2016-04-08T09:34:26Z</dc:date>
    <item>
      <title>Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262334#M51180</link>
      <description>&lt;P&gt;Since I am not allowed to access the database, I receive unloads in the form of a CSV file. These CSV files contain 15 to 20 columns and 700.000 rows. At least 2 (sometimes even more) of these columns contain dates. In the CSV file the used format for these dates are dd/mm/yyyy. Since proc import tries to discover and to recognize data on its own, I format these dates to the SAS default format dMMMyyyy to make this process easier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to import these files using different methods. Proc import with a CSV file, proc import with an Excel file, data infile with a CSV file, data infile with an Excel file, or simply using File &amp;gt; Import Data and configure it using the SAS data import wizard. (I even use informat and format to define every single variable.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using a CSV file, I use the ; delimiter. No matter which above method I use, the delimiter is always ignored (even though I state "delimiter = ';' ;" in my script. To give you an example, the first variable will be "employee number;firstname" and the second variable will be "lastname; division;", while it actually had to be employee number; firstname lastname; division; and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On top of that if I import either a CSV- or Excel file, the log file will show errors regarding invalid data. The error is "Invalid data for var in line 249 126-133". This causes more than 100.000 rows to lose all of their dates and this makes my analysis useless. I don't get why SAS thinks this is invalid data, because I even formatted it into dMMMyyyy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I don't format the dates in the original file, SAS will automatically turn the dates into numbers. I have used several methods to change the format of these columns, but they are simply not changing to dates no matter what I do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know what the best way is to handle these imports, knowing I will only receive CSV- and Excel files. I don't mind converting it to another file type or sorting the data before importing it, but I need SAS to stick to the data inside these files. My entire analysis is based on this data, so if the data goes "corrupt" at the very start, I will have a very bad time. Any ideas or suggestions?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 08:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262334#M51180</guid>
      <dc:creator>Yves_Boonen</dc:creator>
      <dc:date>2016-04-08T08:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262335#M51181</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have to choose I will say data infile.&lt;/P&gt;&lt;P&gt;The behaviour you mention is generated by something wrong in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can give a snapshot of your data and the piece of code you use I am sure the experts in this forum will offer you a great solution.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 08:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262335#M51181</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-04-08T08:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262336#M51182</link>
      <description>&lt;P&gt;Also, is it worth it to make an Excel into a library? (I just briefly touched this subject, so the code below will most likely be incomplete.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname want "C:\temp\sas_data\excelfile.xlsx"&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 08:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262336#M51182</guid>
      <dc:creator>Yves_Boonen</dc:creator>
      <dc:date>2016-04-08T08:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262340#M51183</link>
      <description>&lt;P&gt;The data looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;r_object_id&lt;/TD&gt;&lt;TD&gt;object_name&lt;/TD&gt;&lt;TD&gt;document_direction&lt;/TD&gt;&lt;TD&gt;company&lt;/TD&gt;&lt;TD&gt;type_of_dossier_flow&lt;/TD&gt;&lt;TD&gt;kind_of_document&lt;/TD&gt;&lt;TD&gt;document_handler&lt;/TD&gt;&lt;TD&gt;dossier_number&lt;/TD&gt;&lt;TD&gt;detail_kind_of_document&lt;/TD&gt;&lt;TD&gt;date_treated&lt;/TD&gt;&lt;TD&gt;r_creation_date&lt;/TD&gt;&lt;TD&gt;document_state&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;090241ed8473996c&lt;/TD&gt;&lt;TD&gt;object_title_1&lt;/TD&gt;&lt;TD&gt;OUT&lt;/TD&gt;&lt;TD&gt;division&lt;/TD&gt;&lt;TD&gt;type_of_dossier&lt;/TD&gt;&lt;TD&gt;TRIGGER&lt;/TD&gt;&lt;TD&gt;Name 1&lt;/TD&gt;&lt;TD&gt;dossier_number_1&lt;/TD&gt;&lt;TD&gt;details_1&lt;/TD&gt;&lt;TD&gt;18/mrt/16&lt;/TD&gt;&lt;TD&gt;28/jul/15&lt;/TD&gt;&lt;TD&gt;CLASS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;090241ed8473ae94&lt;/TD&gt;&lt;TD&gt;object_title_2&lt;/TD&gt;&lt;TD&gt;IN&lt;/TD&gt;&lt;TD&gt;division&lt;/TD&gt;&lt;TD&gt;type_of_dossier&lt;/TD&gt;&lt;TD&gt;DOK&lt;/TD&gt;&lt;TD&gt;Name 2&lt;/TD&gt;&lt;TD&gt;dossier_number_2&lt;/TD&gt;&lt;TD&gt;details_2&lt;/TD&gt;&lt;TD&gt;29/jul/15&lt;/TD&gt;&lt;TD&gt;28/jul/15&lt;/TD&gt;&lt;TD&gt;TREATED&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;090241ed865072af&lt;/TD&gt;&lt;TD&gt;object_title_3&lt;/TD&gt;&lt;TD&gt;IN&lt;/TD&gt;&lt;TD&gt;division&lt;/TD&gt;&lt;TD&gt;type_of_dossier&lt;/TD&gt;&lt;TD&gt;DON&lt;/TD&gt;&lt;TD&gt;Name 3&lt;/TD&gt;&lt;TD&gt;dossier_number_3&lt;/TD&gt;&lt;TD&gt;details_3&lt;/TD&gt;&lt;TD&gt;08/dec/15&lt;/TD&gt;&lt;TD&gt;27/nov/15&lt;/TD&gt;&lt;TD&gt;TREATED&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;090241ed840d8e61&lt;/TD&gt;&lt;TD&gt;object_title_4&lt;/TD&gt;&lt;TD&gt;IN&lt;/TD&gt;&lt;TD&gt;division&lt;/TD&gt;&lt;TD&gt;type_of_dossier&lt;/TD&gt;&lt;TD&gt;DOD&lt;/TD&gt;&lt;TD&gt;Name 4&lt;/TD&gt;&lt;TD&gt;dossier_number_4&lt;/TD&gt;&lt;TD&gt;details_4&lt;/TD&gt;&lt;TD&gt;30/jun/15&lt;/TD&gt;&lt;TD&gt;26/jun/15&lt;/TD&gt;&lt;TD&gt;TREATED&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;090241ed840d9642&lt;/TD&gt;&lt;TD&gt;object_title_5&lt;/TD&gt;&lt;TD&gt;OUT&lt;/TD&gt;&lt;TD&gt;division&lt;/TD&gt;&lt;TD&gt;type_of_dossier&lt;/TD&gt;&lt;TD&gt;FAK&lt;/TD&gt;&lt;TD&gt;Name 5&lt;/TD&gt;&lt;TD&gt;dossier_number_5&lt;/TD&gt;&lt;TD&gt;details_5&lt;/TD&gt;&lt;TD&gt;24/mrt/16&lt;/TD&gt;&lt;TD&gt;26/jun/15&lt;/TD&gt;&lt;TD&gt;CLASS&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, company and type_of_dossier_flow are always the same value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variables that really are required for my analysis are kind_of_document, document_handler, date_treated, r_creation_date and document_state.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the proc import code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import 
out=test
datafile="c:\temp\test.csv"
dbms=csv replace;
delimiter=';';
getnames=yes;
datarow=2;
run;

/* FOR EXCEL I CHANGE DATAFILE EXTENTION TO XLSX, DBMS TO XLSX AND REMOVE DELIMITER. */&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the infile code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
infile 'C:\temp\test.csv' firstobs=2;
informat kind_of_document $25.;
informat document_handler $25.;
informat date_treated DATE9.;
informat r_creation_date DATE9.;
informat document_state $25.;
format kind_of_document $25.;
format document_handler $25.;
format date_treated DATE9.;
format r_creation_date DATE9.;
format document_state $25.;
input
kind_of_document $
document_handler $
date_treated
r_creation_date
document_state $
;
if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262340#M51183</guid>
      <dc:creator>Yves_Boonen</dc:creator>
      <dc:date>2016-04-08T09:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262341#M51184</link>
      <description>&lt;P&gt;STAY AWAY from Excel. Period. Causes you endless grief.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And also, don't use PROC IMPORT. It makes the computer make guesses about the data structure, and COMPUTERS ARE DUMB.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a properly written data step from the definition, and you'll be fine forever after. If the structure changes unexpectedly, you get ERROR messages and can react accordingly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need help with creating a data step, provide some test data in original file format and a short description.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:05:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262341#M51184</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-08T09:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262342#M51185</link>
      <description>&lt;P&gt;The data is provided above. The result a table with kind_of_document, document_handler, date_treated, r_creation_date and document_state.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As soon as I can get that table into SAS, I can start working on the data.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262342#M51185</guid>
      <dc:creator>Yves_Boonen</dc:creator>
      <dc:date>2016-04-08T09:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262343#M51186</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You shall import the data file as it is and limit the kept variables within the sas file as to your needs.&lt;/P&gt;&lt;P&gt;So you shall adapt your code, something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; test&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; _EFIERR_ &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token comment"&gt;/* set the ERROR detection macro variable */&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'C:\temp\test.csv'&lt;/SPAN&gt; firstobs&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;informat r_object_id $25.;&lt;BR /&gt;informat object_name $25.;&lt;BR /&gt;etc...&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;format&lt;/SPAN&gt; r_object_ud $25.;&lt;BR /&gt;etc..
&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;
r_object_id.;
&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;keep &lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;YOUR INTEREST VARIABLES&lt;/STRONG&gt;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; _ERROR_ &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; call &lt;SPAN class="token function"&gt;symputx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'_EFIERR_'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;  &lt;SPAN class="token comment"&gt;/* set ERROR detection macro variable */&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:10:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262343#M51186</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-04-08T09:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262345#M51188</link>
      <description>&lt;P&gt;This is my progress now:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tables.test;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
infile 'C:\temp\SAS_Data\Tables\document.csv' firstobs=2;
informat r_object_id $16.;informat object_name $25.;informat document_direction $5.;informat company $3.;informat type_of_dossier_flow $15.;informat kind_of_document $8.;informat document_handler $25.;informat dossier_number $6.;informat details_kind_of_document $10.;informat date_treated date9.;informat r_creation_date date9.;informat document_state $10.;
format r_object_id $16.;format object_name $25.;format document_direction $5.;format company $3.;format type_of_dossier_flow $15.;format kind_of_document $8.;format document_handler $25.;format dossier_number $6.;format details_kind_of_document $10.;format date_treated date9.;format r_creation_date date9.;format document_state $10.;
input&lt;BR /&gt;r_object_id.; /* &amp;lt;--- Why is this here? Do I need to add anything to it? */
;keep kind_ofdocument document_handler date_treated r_creation_date document_state;
if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;403  data tables.test;
404  %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
405  infile 'C:\temp\SAS_Data\Tables\document.csv' firstobs=2;
406  informat r_object_id $16.;informat object_name $25.;informat document_direction $5.;informat
406! company $3.;informat type_of_dossier_flow $15.;informat kind_of_document $8.;informat
406! document_handler $25.;informat dossier_number $6.;informat details_kind_of_document $10.;
406! informat date_treated date9.;informat r_creation_date date9.;informat document_state $10.;
407  format r_object_id $16.;format object_name $25.;format document_direction $5.;format company
407! $3.;format type_of_dossier_flow $15.;format kind_of_document $8.;format document_handler $25.
407! ;format dossier_number $6.;format details_kind_of_document $10.;format date_treated date9.;
407! format r_creation_date date9.;format document_state $10.;
408  input
409
410  ;keep kind_ofdocument document_handler date_treated r_creation_date document_state;
411  if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
412  run;

NOTE: Variable r_object_id is uninitialized.
NOTE: Variable object_name is uninitialized.
NOTE: Variable document_direction is uninitialized.
NOTE: Variable company is uninitialized.
NOTE: Variable type_of_dossier_flow is uninitialized.
NOTE: Variable kind_of_document is uninitialized.
NOTE: Variable document_handler is uninitialized.
NOTE: Variable dossier_number is uninitialized.
NOTE: Variable details_kind_of_document is uninitialized.
NOTE: Variable date_treated is uninitialized.
NOTE: Variable r_creation_date is uninitialized.
NOTE: Variable document_state is uninitialized.
WARNING: The variable kind_ofdocument in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: The infile 'C:\temp\SAS_Data\Tables\document.csv' is:
      Filename=C:\temp\SAS_Data\Tables\document.csv,
      RECFM=V,LRECL=32767,
      File Size (bytes)=123899780,
      Last Modified=08 april 2016 11:24:34 uur,
      Create Time=08 april 2016 08:43:27 uur

NOTE: 696743 records were read from the infile 'C:\temp\SAS_Data\Tables\document.csv'.
      The minimum record length was 81.
      The maximum record length was 348.
NOTE: The data set TABLES.TEST has 696743 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.29 seconds
      cpu time            0.29 seconds


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;An empty table with my keep variables.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262345#M51188</guid>
      <dc:creator>Yves_Boonen</dc:creator>
      <dc:date>2016-04-08T09:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262346#M51189</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are using locale specific month names. SAS can deal with this kind of date when you set the LOCALE= system option accordingly and use one of the NL... date informats. It looks liek that for dutch SAS expects the month abreviation as mrt. instead of just mrt as in your example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is some code to illustrate this. So if you can get the dates in a locale independent format, everything would be a lot easier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options locale=nl_NL ;
data want;
  infile cards dlm=";";
  input
    detail_kind_of_document : $32.
    date_treated	: $32.
  ;
  someDate = "01mar2016"d;
  date_treated_n = input(date_treated, nldate20.);
  format date_treated_n ddmmyyp10.;
  format someDate NLDATEL12.;
cards4;
details_1;18/mrt./16
details_2;29/jul/15
details_3;08/dec/15
details_4;30/jun/15
details_5;24/mrt/16
;;;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:34:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262346#M51189</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-04-08T09:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262347#M51190</link>
      <description>&lt;P&gt;What does that cards command doe actually?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have seen it a couple times now, but I am clueless as to why you would use that.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262347#M51190</guid>
      <dc:creator>Yves_Boonen</dc:creator>
      <dc:date>2016-04-08T09:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262348#M51191</link>
      <description>&lt;P&gt;Yves&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The CARDS or DATALINES statement allows to simulate the data from an external file as part of your code. this is very convenient for testing purposes or provide sample data as part of a program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bruno&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:42:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262348#M51191</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-04-08T09:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262350#M51193</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need the inout statement to bring the values to sas database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So just add :&lt;/P&gt;&lt;P&gt;input&lt;BR /&gt;&amp;nbsp;r_object_id $&lt;BR /&gt;&amp;nbsp;format object_name $&lt;BR /&gt;&amp;nbsp;document_direction $&lt;BR /&gt;&amp;nbsp;format company $&lt;BR /&gt;&amp;nbsp;format type_of_dossier_flow $&lt;BR /&gt;&amp;nbsp;kind_of_document $&lt;BR /&gt;&amp;nbsp;document_handler $&lt;BR /&gt;&amp;nbsp;dossier_number $&lt;BR /&gt;&amp;nbsp;details_kind_of_document $&lt;BR /&gt;&amp;nbsp;date_treated&lt;BR /&gt;&amp;nbsp;r_creation_date&lt;BR /&gt;&amp;nbsp;document_state $&lt;BR /&gt;&amp;nbsp;;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262350#M51193</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-04-08T09:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262353#M51194</link>
      <description>&lt;P&gt;Now the issue I was having, has come up again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;453  data tables.test;
454  %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
455  infile 'C:\temp\SAS_Data\Tables\document.csv' firstobs=2;
456  informat r_object_id $16.;informat object_name $25.;informat document_direction $5.;informat
456! company $3.;informat type_of_dossier_flow $15.;informat kind_of_document $32.;informat
456! document_handler $32.;informat dossier_number $6.;informat details_kind_of_document $10.;
456! informat date_treated date11.;informat r_creation_date date11.;informat document_state $32.;
457  format r_object_id $16.;format object_name $25.;format document_direction $5.;format company
457! $3.;format type_of_dossier_flow $15.;format kind_of_document $32.;format document_handler
457! $32.;format dossier_number $6.;format details_kind_of_document $10.;format date_treated
457! date11.;format r_creation_date date11.;format document_state $32.;
458  input
459  r_object_id $
460  format object_name $
461  document_direction $
462  format company $
463  format type_of_dossier_flow $
464  kind_of_document $
465  document_handler $
466  dossier_number $
467  details_kind_of_document $
468  date_treated
469  r_creation_date
470  document_state $
471  ;
472  keep kind_of_document document_handler date_treated r_creation_date document_state;
473  if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
474  run;

NOTE: The infile 'C:\temp\SAS_Data\Tables\document.csv' is:
      Filename=C:\temp\SAS_Data\Tables\document.csv,
      RECFM=V,LRECL=32767,
      File Size (bytes)=123899780,
      Last Modified=08 april 2016 11:24:34 uur,
      Create Time=08 april 2016 08:43:27 uur

NOTE: Invalid data for format in line 2 31-35.
NOTE: Invalid data for format in line 2 108-112.
NOTE: Invalid data for format in line 3 1-24.
NOTE: Invalid data for date_treated in line 4 1-24.
NOTE: Invalid data for r_creation_date in line 4 26-70.
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tables.test;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
infile 'C:\temp\SAS_Data\Tables\document.csv' firstobs=2;
informat r_object_id $16.;informat object_name $25.;informat document_direction $5.;informat company $3.;informat type_of_dossier_flow $15.;informat kind_of_document $32.;informat document_handler $32.;informat dossier_number $6.;informat details_kind_of_document $10.;informat date_treated date11.;informat r_creation_date date11.;informat document_state $32.;
format r_object_id $16.;format object_name $25.;format document_direction $5.;format company $3.;format type_of_dossier_flow $15.;format kind_of_document $32.;format document_handler $32.;format dossier_number $6.;format details_kind_of_document $10.;format date_treated date11.;format r_creation_date date11.;format document_state $32.;
input
r_object_id $
format object_name $
document_direction $
format company $
format type_of_dossier_flow $
kind_of_document $
document_handler $
dossier_number $
details_kind_of_document $
date_treated
r_creation_date
document_state $
;
keep kind_of_document document_handler date_treated r_creation_date document_state;
if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And the result is a crazy table. See the attachment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12439i44104BD050135C8B/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="test.JPG" title="test.JPG" /&gt;</description>
      <pubDate>Fri, 08 Apr 2016 11:21:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262353#M51194</guid>
      <dc:creator>Yves_Boonen</dc:creator>
      <dc:date>2016-04-08T11:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262357#M51195</link>
      <description>&lt;P&gt;Edit, your datafile is NOT a CSV file. &amp;nbsp;It is a delimited file, you need to specify the delimiter, and also question with the person sending the file why they have used a semicolon in a Comma Seperated Variable file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would help if you provided the CSV with a couple of lines so we can run it on our end. &amp;nbsp;Also, formatting your code will help readbility (remember, most code is looked at by other people, anything you can do to make that code simple and easy to read will make everyones life easier) - and in the below I have corrected several typos - inputr_object_id is not valid syntax for example. &amp;nbsp;The input line is the key line here, this is the one that actually reads the data in, the informat statement tells the reader what format the data comes in as, and format tesll the reader what to write to the dataset as. &amp;nbsp;The input here just states if the incoming is a string or not - you will see character ones have a $, numeric don't. &amp;nbsp;I would also suggest you put a lenght statement in:&lt;/P&gt;
&lt;PRE&gt;data tables.test;
  infile 'C:\temp\SAS_Data\Tables\document.csv' dlm=";" firstobs=2;
  length    r_object_id $16
            object_name $25
            document_direction $5
            company $3
            type_of_dossier_flow $15
            kind_of_document $8
            document_handler $25
            dossier_number $6
            details_kind_of_document $10
            date_treated 8
            r_creation_date 8
            document_state $10;
  informat  r_object_id $16.
            object_name $25.
            document_direction $5.
            company $3.
            type_of_dossier_flow $15.
            kind_of_document $8.
            document_handler $25.
            dossier_number $6.
            details_kind_of_document $10.
            date_treated date9.
            r_creation_date date9.
            document_state $10.;
  format    r_object_id $16.
            object_name $25.
            document_direction $5.
            company $3.
            type_of_dossier_flow $15.
            kind_of_document $8.
            document_handler $25.
            dossier_number $6.
            details_kind_of_document $10.
            date_treated date9.
            r_creation_date date9.
            document_state $10.;
  input     r_object_id $
            object_name $
            document_direction $
            company $
            type_of_dossier_flow $
            kind_of_document $
            document_handler $
            dossier_number $
            details_kind_of_document $
            date_treated 
            r_creation_date 
            document_state $; 
  keep      kind_ofdocument 
            document_handler 
            date_treated 
            r_creation_date 
            document_state;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262357#M51195</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-08T09:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262358#M51196</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in your code you have written &lt;STRONG&gt;format&amp;nbsp;&lt;/STRONG&gt;where it should have been &lt;STRONG&gt;input&lt;/STRONG&gt; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 09:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262358#M51196</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-04-08T09:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262361#M51197</link>
      <description>&lt;P&gt;Here are the 10 first rows of the data sheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The format input problem is due to copy pasting stuff.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 10:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262361#M51197</guid>
      <dc:creator>Yves_Boonen</dc:creator>
      <dc:date>2016-04-08T10:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262362#M51198</link>
      <description>&lt;P&gt;I imported this:&lt;/P&gt;
&lt;PRE&gt;r_object_id;object_name;document_direction;company;type_of_dossier_flow;kind_of_document;document_handler;dossier_number;detail_kind_of_document;date_treated;r_creation_date;document_state
090241ed8473996c;object_title_1;OUT;division;type_of_dossier;TRIGGER;Name 1;dossier_number_1;details_1;18/mrt/16;28/jul/15;CLASS
090241ed8473ae94;object_title_2;IN;division;type_of_dossier;DOK;Name 2;dossier_number_2;details_2;29/jul/15;28/jul/15;TREATED
090241ed865072af;object_title_3;IN;division;type_of_dossier;DON;Name 3;dossier_number_3;details_3;08/dec/15;27/nov/15;TREATED
090241ed840d8e61;object_title_4;IN;division;type_of_dossier;DOD;Name 4;dossier_number_4;details_4;30/jun/15;26/jun/15;TREATED
090241ed840d9642;object_title_5;OUT;division;type_of_dossier;FAK;Name 5;dossier_number_5;details_5;24/mrt/16;26/jun/15;CLASS
&lt;/PRE&gt;
&lt;P&gt;using this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro convert_date(invar,outvar);
format &amp;amp;outvar yymmdd10.;
&amp;amp;invar = tranwrd(&amp;amp;invar,'mrt','mar');
&amp;amp;invar = tranwrd(&amp;amp;invar,'mei','may');
&amp;amp;invar = tranwrd(&amp;amp;invar,'okt','oct');
&amp;amp;outvar = input(&amp;amp;invar,date9.);
drop &amp;amp;invar;
%mend;

data boonen;
infile '$HOME/sascommunity/boonen.txt' dlm=';' truncover firstobs=2 lrecl=500;
length
  r_object_id $16
  object_name $100
  document_direction $3
  company $10
  type_of_dossier_flow $20
  kind_of_document $10
  document_handler $20
  dossier_number $20
  detail_kind_of_document $100
  date_treated_c $9
  date_treated 5
  r_creation_date_c $9
  r_creation_date 5
  document_state $10
;
input
  r_object_id
  object_name
  document_direction
  company
  type_of_dossier_flow
  kind_of_document
  document_handler
  dossier_number
  detail_kind_of_document
  date_treated_c
  r_creation_date_c
  document_state
;
%convert_date(date_treated_c,date_treated);
%convert_date(r_creation_date_c,r_creation_date);
run;

proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;with no errors, thsi is the result:&lt;/P&gt;
&lt;PRE&gt;                                                              document_                   type_of_        kind_of_
                 Obs      r_object_id        object_name      direction    company      dossier_flow      document

                  1     090241ed8473996c    object_title_1       OUT       division    type_of_dossier    TRIGGER 
                  2     090241ed8473ae94    object_title_2       IN        division    type_of_dossier    DOK     
                  3     090241ed865072af    object_title_3       IN        division    type_of_dossier    DON     
                  4     090241ed840d8e61    object_title_4       IN        division    type_of_dossier    DOD     
                  5     090241ed840d9642    object_title_5       OUT       division    type_of_dossier    FAK     

                                                          detail_
                        document_                        kind_of_          date_    r_creation_    document_
                 Obs     handler      dossier_number     document        treated       date          state

                  1      Name 1      dossier_number_1    details_1    2016-03-18    2015-07-28      CLASS   
                  2      Name 2      dossier_number_2    details_2    2015-07-29    2015-07-28      TREATED 
                  3      Name 3      dossier_number_3    details_3    2015-12-08    2015-11-27      TREATED 
                  4      Name 4      dossier_number_4    details_4    2015-06-30    2015-06-26      TREATED 
                  5      Name 5      dossier_number_5    details_5    2016-03-24    2015-06-26      CLASS   
&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Apr 2016 10:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262362#M51198</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-08T10:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262364#M51199</link>
      <description>&lt;P&gt;PS I wrote this data step code in about 15 minutes, including editing the test data. Once you get used to it, you'll be quite as quick.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 10:08:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262364#M51199</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-08T10:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262366#M51200</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, as I said, it would be useful if you posted the file you were trying to import (the one called csv in your example). &amp;nbsp;That below you have posted is an Excel file - which doesn't match what you were trying to import (and I don't download Excel files as they are a security risk).&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 10:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262366#M51200</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-08T10:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: Importing data from external files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262372#M51202</link>
      <description>&lt;P&gt;I&amp;nbsp;copied the data from the&amp;nbsp;CSV file and pasted it into&amp;nbsp;Excel, but forgot to save it appropriatly.&amp;nbsp;It seems you can't attach CSV files either.&amp;nbsp;Just rename the .txt to .csv and you should be ready to go.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 10:36:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-data-from-external-files/m-p/262372#M51202</guid>
      <dc:creator>Yves_Boonen</dc:creator>
      <dc:date>2016-04-08T10:36:12Z</dc:date>
    </item>
  </channel>
</rss>

