BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Gick
Pyrite | Level 9
%macro import_files(BIO=);
/*1**/

data fichiers (keep=fichiers);
length fichiers $256;
fich=filename('fich',"&BIO.");
/* */
did=dopen('fich');
/* compt */
nb_fich=dnum(did);
do i=1 TO nb_fich;
fichiers=dread(did,i);
output;
end;
/* */
rc=dclose(did);
run;

/*2 */
proc sql;
select SUBSTR(fichiers, 1, INDEX(fichiers, '.') - 1) into :Labo_list separated by ' '
from fichiers;
quit;
%put &Labo_list.; /* log */

/*3 -*/
%do l = 1 %to %sysfunc(countw(&Labo_list.));
%let labo = %scan(&Labo_list., &l.);
%put &labo.;
proc import datafile="&BIO.\&labo." out=Labo&l.
dbms=XLSX replace;
run;
%end;


data BDD_labo;
set
%do i = 1 %to %sysfunc(countw(&Labo_list.));
Labo&i.
%end;
;
run;

%mend;

%import_files(BIO=C:\BIO);

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 2623 views
  • 0 likes
  • 5 in conversation