Hi Kurt Thanks for the correction, the final code is: %let ruta="\\crgldept01p.cri.bns\MOVEIT\CR\TsysSchemeFiles\";
filename myDir &ruta ;
data test (keep=filename);
did=dopen("myDir") ;
filecount=dnum(did) ;
do i=1 to filecount ;
filename=dread(did,i) ;
*if scan(filename,2,".")="csv" then put filename ;
if scan(filename,2,".")="csv" then
filename= &ruta. || filename;
output ;
end ;
rc=dclose(did) ;
run ; And the log is: 1 The SAS System 16:36 Tuesday, February 16, 2021
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='list_files';
4 %LET _CLIENTPROCESSFLOWNAME='Flujo del proceso';
5 %LET _CLIENTPROJECTPATH='C:\FVG\SAS\prueba.egp';
6 %LET _CLIENTPROJECTPATHHOST='LPC0PHWAVMEXBT';
7 %LET _CLIENTPROJECTNAME='prueba.egp';
8 %LET _SASPROGRAMFILE='';
9 %LET _SASPROGRAMFILEHOST='';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=PNG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 FILENAME EGSR TEMP;
15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16 STYLE=HTMLBlue
17 STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HTMLBlue.css")
18 NOGTITLE
19 NOGFOOTNOTE
20 GPATH=&sasworklocation
21 ENCODING=UTF8
22 options(rolap="on")
23 ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24
25 GOPTIONS ACCESSIBLE;
26 %let ruta="\\crgldept01p.cri.bns\MOVEIT\CR\TsysSchemeFiles\";
27 filename myDir &ruta ;
28
29 data test (keep=filename);
30 did=dopen(myDir) ;
31 filecount=dnum(did) ;
32 do i=1 to filecount ;
33 filename=dread(did,i) ;
34 *if scan(filename,2,".")="csv" then put filename ;
35 if scan(filename,2,".")="csv" then
36 filename= &ruta. || filename;
37 output ;
38 end ;
39 rc=dclose(did) ;
40 run ;
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
30:12
NOTE: Variable myDir is uninitialized.
NOTE: Argument 1 to function DNUM(0) at line 31 column 12 is invalid.
ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or the BY expression is missing, zero,
or invalid.
did=0 myDir=. filecount=. i=1 filename= rc=. _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to
missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 31:12
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.TEST may be incomplete. When this step was stopped there were 0 observations and 1 variables.
WARNING: Data set WORK.TEST was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
2 The SAS System 16:36 Tuesday, February 16, 2021
cpu time 0.00 seconds
41
42
43 GOPTIONS NOACCESSIBLE;
44 %LET _CLIENTTASKLABEL=;
45 %LET _CLIENTPROCESSFLOWNAME=;
46 %LET _CLIENTPROJECTPATH=;
47 %LET _CLIENTPROJECTPATHHOST=;
48 %LET _CLIENTPROJECTNAME=;
49 %LET _SASPROGRAMFILE=;
50 %LET _SASPROGRAMFILEHOST=;
51
52 ;*';*";*/;quit;run;
53 ODS _ALL_ CLOSE;
54
55
56 QUIT; RUN;
57 Now it seems the "myDir" variable is not working... Thanks again. Fer
... View more