%let rptout = \\remote1; data cars(keep=make drivetrain length); set sashelp.cars; run; data _null_; file "&rptout\test..txt" lrecl=119 TERMSTR=crlf; set cars; put @1 make $9. @10 drivetrain $15. @16 length $5 ; run;
When I run the code I am getting an insufficient authorization message. Yet when I run the code using the following code it runs without issue.
PROC EXPORT
OUTFILE = "&rptout\cars..xlsb"
DATA= cars
DBMS= EXCELCS REPLACE;
SHEET='sheet1';
SERVER="sas-pcff.share1-prd.com";
PORT = 9999;
SERVERUSER="&suserid.";
SERVERPASS="&mypass.";
run;
The issue is I need this with a txt extension and with columns in tab set up like the first dataset
Since your Proc Export code includes Port, ServerUser and Serverpass parameters and works correctly but your DATA step does not include any such permissions related parameters then that means that you likely need to include the equivalents in the data step.
Proc EXPORT will create TAB delimited output files using DBMS=TAB and use the .TXT extension in the outfile. Not that SHEET is not going to be valid with a TAB file.
You have an extra . in both versions of your output name. The "extra" dot would be needed if the part of the file name immediately before the extension is a macro variable such as "path\&somevar..txt" as the first . is used to tell the macro processor that is the end of the macro variable. If you used "path\&somevar.txt" then that first . with that use means there would not be a dot before the extension.
When you use EXCELCS, you communicate from the SAS server with a SAS PC File Server instance on a remote host. This PC File Server process has the necessary permissions for the target resource, while your SAS process has not. This needs to be resolved with your server admins; they must make sure that the userid running your SAS process gets the necessary permission for the shared network resource.
The PC Files Server is specifically designed for MS Office files (Excel, Access), not for text files.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.