Windows 10 with SAS 9.4M5--I have two DLCREATEDIR scenarios. One works. The other issues an authorization error on two different PCs where I am admin. You can just run the code snippet with sashelp.cars. Delete the c:\foo directory between each execution.
Scenario 1
options dlcreatedir;
libname foo 'c:\foo';
proc export data=sashelp.cars
outfile='c:\foo\gibberish.tab'
dbms=tab
replace;
run;
Scenario 2
options dlcreatedir;
%let output_path="c:\foo_&sysdate";
%let output_type=tab;
libname foo &output_path;
proc export data=sashelp.cars
outfile=&output_path
dbms=&output_type
replace;
run;
Yields.....
ERROR: Insufficient authorization to access c:\foo_01NOV19.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 1 observations read from the data set SASHELP.CARS.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.06 seconds
Cannot find reference to this anywhere.
Geez. My error! Scenario 2 needs a filename. How silly. Please disregard. Not enough coffee.
I strongly suggest that you look very closely at all of the permissions on both machines. Even though you are an "admin" it may be that on one you can't create directory from the root C drive.
On the machine that gives you problems can you open a command prompt and create directory from a C:\ prompt?
Or that the sessions your SAS runs in have different permissions (less likely).
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.