<?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: Simple import macro error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375057#M89882</link>
    <description>&lt;P&gt;Also note, this program tries to read files named combined1.csv, combined2.csv, ... combined14.csv not Malm1.csv etc.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jul 2017 17:22:17 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-07-11T17:22:17Z</dc:date>
    <item>
      <title>Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375049#M89877</link>
      <description>&lt;P&gt;I am trying to import files that start with the same name: Combined&amp;nbsp;(e.g., &lt;SPAN&gt;Combined1&lt;/SPAN&gt;.csv, &lt;SPAN&gt;Combined2&lt;/SPAN&gt;.csv, &lt;SPAN&gt;Combined3&lt;/SPAN&gt;.csv). I have written a macro that gives an error. I think the error is occuring because of the delimiter. However, without the&amp;nbsp;delimiter, the imported files do not have observations in it. The number and name of the columns is identical, but the number of rows/records is different.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Here is my macro:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Macro importing;
%Do i=1 %To 14;

data WORK.malm&amp;amp;i;
infile "C:\Users\yegen\Desktop\Malmqvist Files\Malmqvist Files\combined&amp;amp;i..csv"
! delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
 informat DMUj0 $10. ;
   informat EffPeriod1 best32. ;
   informat EffPeriod2 best32. ;
    informat EffChange best32. ;
       informat TechChange best32. ;
       informat MalmIndex best32. ;
          informat group best32. ;
          informat industry best32. ;
          format DMUj0 $10. ;
          format EffPeriod1 best12. ;
          format EffPeriod2 best12. ;
          format EffChange best12. ;
         format TechChange best12. ;
          format MalmIndex best12. ;
          format group best12. ;
          format industry best12. ;
       input
                   DMUj0 $
                   EffPeriod1
                   EffPeriod2
                   EffChange
                   TechChange
                   MalmIndex
                   group
                   industry
;
  run;

  %end;
%Mend;

%importing;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the log file:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM1 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM1 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM2 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM2 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM3 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM3 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM4 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM4 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM5 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM5 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM6 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM6 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM7 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM7 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM8 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM8 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM9 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM9 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM10 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM10 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM11 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM11 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM12 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM12 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM13 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM13 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


23: LINE and COLUMN cannot be determined.
NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and
              COLUMN where the error has occurred.
ERROR 23-2: Invalid option name !.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MALM14 may be incomplete.  When this step was stopped there were 0
         observations and 8 variables.
WARNING: Data set WORK.MALM14 was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When I manually import the data (e.g., Malm2), the import works well and here is the log file:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data WORK.example    ;
198      %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
199      infile 'C:\Users\yegen\Desktop\Malmqvist Files\Malmqvist Files\combined2.csv'
199! delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
200         informat DMUj0 $10. ;
201         informat EffPeriod1 best32. ;
202         informat EffPeriod2 best32. ;
203         informat EffChange best32. ;
204         informat TechChange best32. ;
205         informat MalmIndex best32. ;
206         informat group best32. ;
207         informat industry best32. ;
208         format DMUj0 $10. ;
209         format EffPeriod1 best12. ;
210         format EffPeriod2 best12. ;
211         format EffChange best12. ;
212         format TechChange best12. ;
213         format MalmIndex best12. ;
214         format group best12. ;
215         format industry best12. ;
216      input
217                  DMUj0 $
218                  EffPeriod1
219                  EffPeriod2
220                  EffChange
221                  TechChange
222                  MalmIndex
223                  group
224                  industry
225      ;
226      if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
227      run;

NOTE: The infile 'C:\Users\eyub.yegen15\Desktop\Malmqvist Files\Malmqvist Files\combined2.csv' is:
      Filename=C:\Users\eyub.yegen15\Desktop\Malmqvist Files\Malmqvist Files\combined2.csv,
      RECFM=V,LRECL=32767,File Size (bytes)=515848,
      Last Modified=11Jul2017:04:20:28,
      Create Time=11Jul2017:12:24:50

NOTE: 9604 records were read from the infile 'C:\Users\eyub.yegen15\Desktop\Malmqvist
      Files\Malmqvist Files\combined2.csv'.
      The minimum record length was 25.
      The maximum record length was 85.
NOTE: The data set WORK.EXAMPLE has 9604 observations and 8 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds


9604 rows created in WORK.example from C:\Users\eyub.yegen15\Desktop\Malmqvist Files\Malmqvist
Files\combined2.csv.



NOTE: WORK.EXAMPLE data set was successfully created.
NOTE: The data set WORK.EXAMPLE has 9604 observations and 8 variables.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 17:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375049#M89877</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-07-11T17:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375055#M89880</link>
      <description>&lt;P&gt;1) &amp;nbsp;you can save typing by change:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat var1 fmt1.;
informat var2 fmt2.;
...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;into:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat var1 fmt1.  var2 fmt2.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and if fmt1 is same as fmt2 it can be written as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat var1 var2 fmt.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) &amp;nbsp;Your error tells: &amp;nbsp;&lt;STRONG&gt;Invalid option name !.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Why do you added the&amp;nbsp;&lt;STRONG&gt;!&lt;/STRONG&gt; (exclamation mark) in your code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile "C:\Users\yegen\Desktop\Malmqvist Files\Malmqvist Files\combined&amp;amp;i..csv"
! delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 17:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375055#M89880</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-07-11T17:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375057#M89882</link>
      <description>&lt;P&gt;Also note, this program tries to read files named combined1.csv, combined2.csv, ... combined14.csv not Malm1.csv etc.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 17:22:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375057#M89882</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-11T17:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375059#M89883</link>
      <description>&lt;P&gt;Thanks very much&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;. Your suggestion has solved the error. After deleting the !, the macro worked. The reason why I have included ! is that when I manually imported the one of the samples, in the code that was displayed in the log file there was a ! after the file name and before the delimiter.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 17:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375059#M89883</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-07-11T17:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375060#M89884</link>
      <description>&lt;P&gt;Sorry for the confusion,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;. That was a simple typo that I will fix in my original question. The file names start with combined. Thanks for pointing it out.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 17:28:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375060#M89884</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-07-11T17:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375061#M89885</link>
      <description>&lt;P&gt;Also, one more quick clarification&amp;nbsp;question. What exactly does the following do in the code?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;MISSOVER DSD lrecl=32767&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Jul 2017 17:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375061#M89885</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-07-11T17:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375068#M89890</link>
      <description>&lt;P&gt;Your input file is defined within a delimiter.&lt;/P&gt;
&lt;P&gt;Your input statemant is in a format of: &amp;nbsp;INPUT var1 var2 ...varn;&lt;/P&gt;
&lt;P&gt;In case &amp;nbsp;one of those variables is miising, you probably want to get its missing value,&lt;/P&gt;
&lt;P&gt;therefore you need the MISSOVER option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case there are consequent delimiters, you probably still want to relate to each as skipping to next variable,&lt;/P&gt;
&lt;P&gt;and assigning missing value to those variables skipped, that is done by the DSD option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LRECL means &lt;STRONG&gt;L&lt;/STRONG&gt;ogical &lt;STRONG&gt;Rec&lt;/STRONG&gt;ord &lt;STRONG&gt;L&lt;/STRONG&gt;ength .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope it answers your question.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 18:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375068#M89890</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-07-11T18:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375098#M89898</link>
      <description>&lt;P&gt;This was very clear and helpful. I really appreciate your helpful explanations and help&amp;nbsp;as always,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 19:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375098#M89898</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-07-11T19:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375199#M89925</link>
      <description>&lt;P&gt;Your original LOG from the running PROC IMPORT included the &lt;STRONG&gt;!&lt;/STRONG&gt; because the line of code generated was longer than the line length SAS was using to write the LOG. &amp;nbsp;Notice how the line number with the &lt;STRONG&gt;!&lt;/STRONG&gt; at the beginning is the same as the one before.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can greatly simplify your data step code since character variable and numbers do not require that you attach special INFORMATs to read them or special FORMATs for them to be properly displayed. &amp;nbsp;You will have better control of how your variables are defined if they are defined explicitly using a LENGTH or ATTRIB statement. rather than forcing SAS to &lt;STRONG&gt;guess&lt;/STRONG&gt; at how you intended to define the variable based on what FORMAT or INFORMAT you attached to it. &amp;nbsp;Also if you define the variables in the order that they will be read you can simplify the INPUT statement by using a variable list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also if you want to read ALL of the CSV files with that name pattern (rather than just those with numeric suffixes of 1 to 14) you can actually do it with one data step instead of in a loop.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data malm;
  infile "...\combined*.csv" dsd truncover eov=eov firstobs=2 ;
  length DMUj0 $10 EffPeriod1 EffPeriod2 EffChange 8
    TechChange 8 MalmIndex 8
    group 8 industry 8
  ;
  input @;
  if eov then input ;
  input DMUj0 -- industry ;
  eov=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you don't have a variable in the data that will let you know which source file the record came you can look into using the FILENAME= option on the INFILE statement.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 04:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375199#M89925</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-12T04:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375549#M90048</link>
      <description>&lt;P&gt;Thank you so much for this really helpful explanation,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;. Your explanation&amp;nbsp;makes a lot of sense and I have learned quite a lot from your post.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I assume the "\combined*" part does the same&amp;nbsp;as&amp;nbsp;"work.combined:" in the data statement (assuming that all combined files are in the work library), but&amp;nbsp;one needs to use * instead of : since it is an infile statement.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What exactly does the "eov" statement? Does it skip the first line of the data (i.e., variable name)? Also, I could not understand why we need to use&amp;nbsp;@ after input.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 01:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375549#M90048</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-07-13T01:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375550#M90049</link>
      <description>&lt;P&gt;The pattern used in anINFILE statement is like the pattern you would use in the &lt;STRONG&gt;DIR&lt;/STRONG&gt; command in DOS/Windows or the &lt;STRONG&gt;ls&lt;/STRONG&gt; command in Unix. It really has nothing to do with how you would specify dataset names in SAS code. &amp;nbsp;Note that the SAS infile statement will only let you use a single wildcard character to replace just one part of the filename. As to the '...\combined' part of the pattern I just cut out the specific directory name you included in your post because it didn't really matter to understanding the answer and it made the line too long. &amp;nbsp;Obviously you would need to test that the pattern actually matches the exact set of files you want to read. You can also make a fileref that points to multiple files by using a FILENAME statement and then use the fileref you created in the INFILE statement instead of either a quoted physical filenname (as in your example) or a pattern (as in my example). &amp;nbsp;Here is the format for FILENAME statement that points to mutliple files. &amp;nbsp;Basically a list of quoted physical filenames inside a parentheses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename myfiles 
('...\combined1.csv'
 '...\combined2.csv'
 '...\combined3.csv'
)
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The EOV= option on the INFILE statement will name a variable that SAS will set to 1 (true) when you start reading from a new file. It really only makes sense when the INFILE statement is reading from multiple files like in my example. &amp;nbsp;The 'INPUT&amp;nbsp;@;' line will read the next line from the input file(s) and hold it so that it can be read later in the current iteration of the DATA step. You need it so that the EOV variable will be properly set as it is not set until you start to read from the new file. The code in the IF block statement will cause SAS to read in the first line of the file and basically ignore it. That way the real INPUT statement will not have to deal with the header line. Also SAS will not reset the EOV= variable back to false, so that is why the code also includes a line to set EOV back to zero (false) so that we can then detect the first line of the next file.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 01:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375550#M90049</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-13T01:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375552#M90050</link>
      <description>&lt;P&gt;1) &amp;nbsp;The line in&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;'s code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;infile "...\combined*.csv" dsd truncover eov=eov firstobs=2 ;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;means - all csv files starting with COMBINED and any other characters moe, preceeeding the .CSV&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) EOV means End Of Volume. That is a flag you get from sas when last record read from all input files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;You use EOF= to assign a flag for last observation read from sas dataset&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;You use EOV= to assign a flag for last record read from external file(s);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) I leave to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;to explain how next code works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;input @;
  if eov then input ;
  input DMUj0 -- industry ;
  eov=0;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jul 2017 01:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375552#M90050</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-07-13T01:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375560#M90056</link>
      <description>&lt;P&gt;Thanks for this helpful explanation,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;.&amp;nbsp;I see, so EOV notifies SAS that the last observation has been reached and that way, SAS moves to the next dataset, right?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for all of your excellent explanations.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 03:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375560#M90056</guid>
      <dc:creator>Yegen</dc:creator>
      <dc:date>2017-07-13T03:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Simple import macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375561#M90058</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/144925"&gt;@Yegen&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for this helpful explanation,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;.&amp;nbsp;I see, so EOV notifies SAS that the last observation has been reached and that way, SAS moves to the next dataset, right?&amp;nbsp;&lt;BR /&gt;.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is the wrong way to think of it. SAS already knows how to read multiple files. The EOV= option is how you can tell SAS what variable to use so that it can tell YOUR program when it has started reading from a different physical file.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 04:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-import-macro-error/m-p/375561#M90058</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-13T04:53:03Z</dc:date>
    </item>
  </channel>
</rss>

