Skip to content

Commit cd73a3f

Browse files
authored
Create copy_rename_files.sas
1 parent d3151c3 commit cd73a3f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

copy_rename_files.sas

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
/*This is an example of how to copy and rename files in a data step*/
3+
4+
%list_files(&path, csv);
5+
6+
options msglevel=i;
7+
8+
data renameProcess;
9+
set list;
10+
11+
*process to rename;
12+
status_ref1 = filename('fr1', path);
13+
14+
*build filename with dates;
15+
path2 = catt(dir, "/Sample/", name, "_", put(today(), yymmddn8.), ".csv");
16+
status_ref2 = filename('fr2', path2);
17+
18+
*process to copy;
19+
status_copy = fcopy('fr1', 'fr2');
20+
21+
if status_copy=0 then
22+
put 'Copied SRC to DEST.';
23+
else do;
24+
msg=sysmsg();
25+
put status_copy= msg=;
26+
end;
27+
28+
run;

0 commit comments

Comments
 (0)