<?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: Retrieve the list of files in the configured folder then import these different xlsx files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897342#M354588</link>
    <description>&lt;P&gt;&lt;STRONG&gt;START A NEW SESSION.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Then, develop your code as suggested, without macro coding at the beginning, and in steps.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Oct 2023 10:25:55 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-10-05T10:25:55Z</dc:date>
    <item>
      <title>Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897321#M354574</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro import_files(BIO=);
	%if %length(&amp;amp;BIO.) &amp;gt; 0 %then %do;
		/* 1) */
		filename filelist "&amp;amp;BIO.";
		data filelist;
			length filename $256;
			rc = filename('dir', "&amp;amp;BIO.");
			if rc = 0 then
				did = dopen('dir');
			if did &amp;gt; 0 then do while(dread(did) = 0);
				filename = dread(did);
				output;
			end;
			rc = dclose(did);
		run;

		/* 2)  */
		data _null_;
			set filelist;
			call symputx('filename', filename);
			call symputx('filelist', ifc(length(filelist) &amp;gt; 0, "&amp;amp;filelist. " || filename, filename));
		run;

		%let filelist = %sysfunc(compbl(&amp;amp;filelist.));

		%if %length(&amp;amp;filelist.) &amp;gt; 0 %then %do;
			%let cnt = %sysfunc(countw(&amp;amp;filelist.));

			/* 3) */
			%do i = 1 %to &amp;amp;cnt.;
				%let l = %scan(&amp;amp;filelist., &amp;amp;i.);
				
				libname xlsx "&amp;amp;BIO.";
				proc import datafile="&amp;amp;BIO.\&amp;amp;l." out=WORK.Labo&amp;amp;l.
					dbms=XLSX replace;
					getnames=yes;
				run;
				libname xlsx clear;

				
				data BDD_labo;
					set BDD_labo Labo&amp;amp;l.;
				run;
			%end;
		%end;
	%end;
%mend;

%import_files(BIO="C:/DATA/BIO");

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;/* 1) retrieve the list of files in the folder configured in BIO&lt;BR /&gt;2) for each file, without sorting them according to their name, create a list containing the different names and do a do loop to automate the import of all files&lt;BR /&gt;3) each imported base is called Labo&amp;amp;l., and at the end of each import, add a data step to insert the results on the same base which will be called BDD_labo */&lt;BR /&gt;Can someone correct my code. I don't know why it doesn't work. No results and in the log, I get "NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space" "WARNING: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another approach which allows the same steps to be carried out will be welcome.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;Gick&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 08:52:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897321#M354574</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-10-05T08:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897328#M354578</link>
      <description>&lt;P&gt;Macro development needs to start with working non-macro code. So get rid of the macro definition and make your code work&amp;nbsp;&lt;U&gt;step-by-step&lt;/U&gt; (Maxim 34).&lt;/P&gt;
&lt;P&gt;Your DATA _NULL_ step cannot work. You try to use a macro variable in the code which you create in the step. Since the macro variable reference is resolved before the data step is even compiled, it won't find the variable. Instead of the DATA step, use a PROC SQL SELECT INTO to create the macro variable&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select filename into :filelist separated by " "
from filelist;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Somewhere in your code, you need to make sure that you only read filenames ending in .xlsx, then you have to extract a part of the filename before the .xlsx which constitutes a valid SAS name. Create code which does this successfully for a single file before wrapping it (and the import step) in a %DO loop.&lt;/P&gt;
&lt;P&gt;I also recommend to create a new directory for the target library; mixing datasets and non-SAS files in a library is not a good idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your error message indicates that your SAS session has become unstable, either by submitting unbalanced quotes, an incomplete macro definition, or other similar causes. Start a new session before following the above advice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, when you're ready to create the macro, make every macro variable used in the macro local (%LOCAL) to it, so you never have accidental side-effects when calling the macro.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 09:20:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897328#M354578</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-10-05T09:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897329#M354579</link>
      <description>&lt;P&gt;Your code contains several errors. Have you tried running step 2 outside the macro? It will not work (the &amp;amp;FILELIST reference only gets initialized once, when the data step is compiled).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rather than trying to loop inside the macro, I would write a small macro for a single import step (and test that), and then have the first data step write the code to execute for all files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro would be something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro bio_imp(l);
proc import datafile="&amp;amp;BIO.\&amp;amp;l." out=WORK.Labo
	dbms=XLSX replace;
	getnames=yes;
run;

proc append base=BDD_labo data=Labo force;
run;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(I assume that you were trying to collect all the data into BDD_LABO with the last data step, but what your code does is just to overwrite with the newest read table). I did not put the (physical) filename into the output dataset name, as it is probably not a valid name for a SAS table.&lt;/P&gt;
&lt;P&gt;Test the macro with a couple of files, to see that it works as intended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To execute the imports, write code to execute all the macro calls, something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc delete data=BDD_labo;run; /* if the final data already exists, delete it */

data filelist;
	length filename $256;
	rc = filename('dir', "&amp;amp;BIO.");
	if rc = 0 then
		did = dopen('dir');
	if did &amp;gt; 0 then do while(dread(did) = 0);
		filename = dread(did);
		output;
		end;
	rc = dclose(did);
run;

filename tempsas temp;
data&amp;nbsp;_NULL_;
&amp;nbsp;&amp;nbsp;set&amp;nbsp;filelist;
&amp;nbsp;&amp;nbsp;file&amp;nbsp;tempsas;
&amp;nbsp;&amp;nbsp;put&amp;nbsp;'%bio_imp('&amp;nbsp;filename&amp;nbsp;');';
run;

options mprint;
%include&amp;nbsp;tempsas /source2;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also do it with CALL EXECUTE, but I much prefer writing to a temporary file, which you can then take a look at, and perhaps execute one line at a time when testing at first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 09:26:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897329#M354579</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2023-10-05T09:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897330#M354580</link>
      <description>Not clear.&lt;BR /&gt;&lt;BR /&gt;Can you put it in a complete code directly. This will allow me to better understand&lt;BR /&gt;&lt;BR /&gt;THANKS.</description>
      <pubDate>Thu, 05 Oct 2023 09:29:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897330#M354580</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-10-05T09:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897332#M354582</link>
      <description>&lt;P&gt;You can get this warning if there is something wrong with quoting. And once you get into such a situation the code further down the track might no more execute.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case for example: You're passing the parameter value in double quote but then also use the macro variable with this value within double quotes - so now you've got double double quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your code below could work for you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro import_files(BIO=, test=N);

    data work.filelist;
      length mem_name $100;
      keep mem_name;

      fid = filename('dir', "&amp;amp;BIO.");
      if fid = 0 then 
        do;
          did = dopen('dir');
          mem_count=coalesce(dnum(did),0);
          do i=1 to mem_count;
            mem_name=dread(did,i);
            if upcase(scan(mem_name,-1,'.'))='XLSX' then output;
          end;
          rc=dclose(did);
        end;
      rc=dclose(fid);
      call symputx('mem_count',mem_count,'l');
    run;

    %if &amp;amp;mem_count&amp;gt;0 %then
      %do;
        filename codegen temp;
        data _null_;
          stop;
          file codegen;
        run;
        data _null_;
          %if %upcase(&amp;amp;test)=Y %then
            %do;
              file print;
            %end;
          %else
            %do;
              file codegen mod;
            %end;
          set work.filelist;
          put
            "proc import datafile='&amp;amp;BIO\" mem_name +(-1) "'" / 
            "  out=work.__temp                             " /
            "  dbms=XLSX replace;                          " /
            "  getnames=yes;                               " /
            "run;                                          " /
                                                             /
            "data work.__Labo_" _n_ z4. ";"                  /
            "  length source_file $100;                    " /
            "  retain source_file '" mem_name +(-1) "';    " /
            "  set work.__temp;                            " /
            "run;                                          " /
            ;
        run;
      
        proc datasets lib=work nolist nowarn;
          delete bdd_labo __labo_: __temp;
        run;quit;

        %include codegen /source2;
        filename codegen clear;

        data work.bdd_labo;
          set work.__labo_:;
        run;

      %end;

%mend;

%import_files(BIO=C:\temp\bio);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Oct 2023 09:46:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897332#M354582</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-10-05T09:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897336#M354583</link>
      <description>&lt;P&gt;You can try out %dirsAndFiles() macro from the BasePlus package:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Set up the framework and package */

filename packages "%sysfunc(pathname(work))"; /* setup WORK as temporary directory for packages, or any you find convenient */
filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas";
%include SPFinit; /* enable the framework */

%installPackage(SPFinit BasePlus) /* install a package */
%loadPackage(BasePlus)    /* load the package content into the SAS session */
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Code to execute:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/* use %dirsAndFiles() macro from basePlus */

/* help info:
%helpPackage(BasePlus,dirsandfiles)
*/

/* get XLSX files */
%dirsAndFiles(C:/SAS_WORK,ODS=work.ListXLSX,fileExt=XLSX);

/* import in the data */
data _null_;
set work.ListXLSX;
call execute('
proc import 
  datafile=' !! quote(catx('/',root,dname,fn)) !! 
' out=WORK.Labo' !! cats(_N_) !!'
	dbms=XLSX replace;
	getnames=yes;
run;
');
run;

/* get the info about variables lengths */
proc contents 
  data=work._all_
  out=work.variables(where=(memname like 'LABO%'))
  noprint;
run;

proc sql noprint;
  select catx(" ", name, ifc(type=2,"$"," "), max(length))
  into :varsList separated by " "
  from work.variables
  group by name
  ;
quit;

%put *TEST: &amp;amp;varsList.*;

/* put all of it together */
data BDD_labo;
 length &amp;amp;varsList.;
 set labo:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 10:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897336#M354583</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-10-05T10:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897338#M354584</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TableSAS.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88624i54EC335D540DDED7/image-size/large?v=v2&amp;amp;px=999" role="button" title="TableSAS.PNG" alt="TableSAS.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 10:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897338#M354584</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-10-05T10:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897339#M354585</link>
      <description>What I get with this code</description>
      <pubDate>Thu, 05 Oct 2023 10:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897339#M354585</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-10-05T10:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897340#M354586</link>
      <description>&lt;P&gt;This basically means:&lt;/P&gt;
&lt;P&gt;1) there are some unmatched quotes in the code&lt;/P&gt;
&lt;P&gt;2) restart SAS session &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 10:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897340#M354586</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-10-05T10:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897342#M354588</link>
      <description>&lt;P&gt;&lt;STRONG&gt;START A NEW SESSION.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Then, develop your code as suggested, without macro coding at the beginning, and in steps.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 10:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897342#M354588</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-10-05T10:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897343#M354589</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro import_files(BIO=);

data fichiers (keep=fichiers);
length fichiers $256;
fich=filename('fich',"&amp;amp;BIO.");
	did=dopen('fich');
	nb_fich=dnum(did);
	do i=1 TO nb_fich;
		fichiers=dread(did,i);
		output;
	end;
	rc=dclose(did);
run; 


data_null_; SET fichiers;
call symput('Labo'||left(trim(_n_)),fichiers);
call symput('nb',_n_);
run; 


%do l=1 %to %sysfunc(countw(&amp;amp;nb.));
				proc import datafile="&amp;amp;BIO.\&amp;amp;&amp;amp;Labo.&amp;amp;l..xlsx" out=&amp;amp;&amp;amp;Labo.&amp;amp;l.
					dbms=XLSX replace;
				run;  
%end;
			
data BDD_labo; 
   set
   %do i = 1 %to %sysfunc(countw(&amp;amp;nb.));
      Labo&amp;amp;i.
   %end;
   ;
run;

%mend;  

%import_files(BIO=C:\BIO);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is a new code proposal. It works but I still get an error message. What I do not understand.&lt;/P&gt;
&lt;P&gt;Thanks for your help.&lt;BR /&gt;Gick&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 10:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897343#M354589</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-10-05T10:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897344#M354590</link>
      <description>/**here is the log/&lt;BR /&gt;NOTE: Line generated by the invoked macro "IMPORT_FILES".&lt;BR /&gt;24          data fichiers (keep=fichiers); length fichiers $256; fich=filename('fich',"&amp;amp;BIO.");   did=dopen('fich');&lt;BR /&gt;24       ! nb_fich=dnum(did);  do i=1 TO nb_fich;   fichiers=dread(did,i);   output;  end;    rc=dclose(did); run;    data_null_;&lt;BR /&gt;                                                                                                                      __________&lt;BR /&gt;                                                                                                                      180&lt;BR /&gt;24       ! SET fichiers; * Le nom&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the invoked macro "IMPORT_FILES".&lt;BR /&gt;24          data fichiers (keep=fichiers); length fichiers $256; fich=filename('fich',"&amp;amp;BIO.");   did=dopen('fich');&lt;BR /&gt;24       ! nb_fich=dnum(did);  do i=1 TO nb_fich;   fichiers=dread(did,i);   output;  end;    rc=dclose(did); run;    data_null_;&lt;BR /&gt;24       ! SET fichiers; * Le nom&lt;BR /&gt;           ___&lt;BR /&gt;           180&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the invoked macro "IMPORT_FILES".&lt;BR /&gt;24          des fichiers; call symput('Labo'||left(trim(_n_)),fichiers);&lt;BR /&gt;                          ____&lt;BR /&gt;                          180&lt;BR /&gt;&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the invoked macro "IMPORT_FILES".&lt;BR /&gt;24                                                                       * Le nombre de fichiers; call symput('nb',_n_);&lt;BR /&gt;2                                                          Le Système SAS                            12:52 Thursday, October 5, 2023&lt;BR /&gt;&lt;BR /&gt;                                                                                                  ____&lt;BR /&gt;                                                                                                  180&lt;BR /&gt;&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;WARNING: Apparent symbolic reference NB not resolved.&lt;BR /&gt;WARNING: Apparent symbolic reference LABO not resolved.&lt;BR /&gt;NOTE: Line generated by the macro variable "L".&lt;BR /&gt;24         &amp;amp;Labo.1&lt;BR /&gt;           _&lt;BR /&gt;           22&lt;BR /&gt;           200</description>
      <pubDate>Thu, 05 Oct 2023 10:37:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897344#M354590</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-10-05T10:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897347#M354591</link>
      <description>for a new code proposed</description>
      <pubDate>Thu, 05 Oct 2023 10:40:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897347#M354591</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-10-05T10:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897356#M354594</link>
      <description>NOTE: Line generated by the invoked macro "IMPORT_FILES".&lt;BR /&gt;68               data fichiers (keep=fichiers); length fichiers $256; fich=filename('fich',"&amp;amp;BIO.");   did=dopen('fich');&lt;BR /&gt;68       ! nb_fich=dnum(did);  do i=1 TO nb_fich;   fichiers=dread(did,i);   output;  end;    rc=dclose(did); run;      data_null_;&lt;BR /&gt;                                                                                                                        __________&lt;BR /&gt;                                                                                                                        180&lt;BR /&gt;68       ! SET fichiers; * Le&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the invoked macro "IMPORT_FILES".&lt;BR /&gt;68               data fichiers (keep=fichiers); length fichiers $256; fich=filename('fich',"&amp;amp;BIO.");   did=dopen('fich');&lt;BR /&gt;68       ! nb_fich=dnum(did);  do i=1 TO nb_fich;   fichiers=dread(did,i);   output;  end;    rc=dclose(did); run;      data_null_;&lt;BR /&gt;68       ! SET fichiers; * Le&lt;BR /&gt;           ___&lt;BR /&gt;           180&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the invoked macro "IMPORT_FILES".&lt;BR /&gt;68          des fichiers; call symput('Labo'||left(trim(_n_)),fichiers);&lt;BR /&gt;                          ____&lt;BR /&gt;                          180&lt;BR /&gt;&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the invoked macro "IMPORT_FILES".&lt;BR /&gt;68                                                                       * Le nombre de fichiers; call symput('nb',_n_);&lt;BR /&gt;                                                                                                  ____&lt;BR /&gt;                                                                                                  180&lt;BR /&gt;&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;&lt;BR /&gt;WARNING: Apparent symbolic reference NB not resolved.&lt;BR /&gt;WARNING: Apparent symbolic reference LABO not resolved.&lt;BR /&gt;NOTE: Line generated by the macro variable "L".&lt;BR /&gt;68         &amp;amp;Labo.1&lt;BR /&gt;           _&lt;BR /&gt;           22&lt;BR /&gt;           200&lt;BR /&gt;WARNING: Apparent symbolic reference LABO not resolved.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;3                                                          Le Système SAS                            13:41 Thursday, October 5, 2023&lt;BR /&gt;&lt;BR /&gt;      real time           0.00 seconds&lt;BR /&gt;      cpu time            0.00 seconds&lt;BR /&gt;      &lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;&lt;BR /&gt;ERROR 22-322: Attendu : un nom.  &lt;BR /&gt;&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;WARNING: Apparent symbolic reference NB not resolved.&lt;BR /&gt;ERROR: Le fichier WORK.LABO1.DATA n'existe pas.</description>
      <pubDate>Thu, 05 Oct 2023 11:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897356#M354594</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-10-05T11:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897372#M354607</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416124"&gt;@Gick&lt;/a&gt;&amp;nbsp;The code I've shared is tested and will work as long as the first sheets in your Excels aren't too messy - like a column in one only having cells with digits and though mapping into a SAS numerical variables and then in another Excel the exactly same named column with alphanumeric values mapping into a SAS character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to start a NEW SAS SESSION. The error you get is due to unbalanced quotation marks from running some other code in the same SAS session.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 12:11:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897372#M354607</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-10-05T12:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve the list of files in the configured folder then import these different xlsx files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897375#M354609</link>
      <description>%macro import_files(BIO=);&lt;BR /&gt;/*1**/&lt;BR /&gt;&lt;BR /&gt;data fichiers (keep=fichiers);&lt;BR /&gt;    length fichiers $256;&lt;BR /&gt;    fich=filename('fich',"&amp;amp;BIO.");&lt;BR /&gt;    /*  */&lt;BR /&gt;    did=dopen('fich');&lt;BR /&gt;    /* compt */&lt;BR /&gt;    nb_fich=dnum(did);&lt;BR /&gt;    do i=1 TO nb_fich;&lt;BR /&gt;        fichiers=dread(did,i);&lt;BR /&gt;        output;&lt;BR /&gt;    end;&lt;BR /&gt;    /* */&lt;BR /&gt;    rc=dclose(did);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/*2 */&lt;BR /&gt;proc sql;&lt;BR /&gt;select SUBSTR(fichiers, 1, INDEX(fichiers, '.') - 1) into :Labo_list separated by ' '&lt;BR /&gt;from fichiers;&lt;BR /&gt;quit;&lt;BR /&gt;%put &amp;amp;Labo_list.; /*  log */&lt;BR /&gt;  &lt;BR /&gt;/*3 -*/&lt;BR /&gt;%do l = 1 %to %sysfunc(countw(&amp;amp;Labo_list.));&lt;BR /&gt;    %let labo = %scan(&amp;amp;Labo_list., &amp;amp;l.);&lt;BR /&gt;		%put &amp;amp;labo.;&lt;BR /&gt;    proc import datafile="&amp;amp;BIO.\&amp;amp;labo." out=Labo&amp;amp;l. &lt;BR /&gt;        dbms=XLSX replace;&lt;BR /&gt;    run;  &lt;BR /&gt;%end;        &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data BDD_labo;&lt;BR /&gt;		set&lt;BR /&gt;%do i = 1 %to %sysfunc(countw(&amp;amp;Labo_list.));&lt;BR /&gt;     Labo&amp;amp;i.&lt;BR /&gt;%end;&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%mend;    &lt;BR /&gt;  &lt;BR /&gt;%import_files(BIO=C:\BIO);</description>
      <pubDate>Thu, 05 Oct 2023 12:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-the-list-of-files-in-the-configured-folder-then-import/m-p/897375#M354609</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-10-05T12:22:41Z</dc:date>
    </item>
  </channel>
</rss>

