BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10
%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

 

2 REPLIES 2
ballardw
Super User

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.

Kurt_Bremser
Super User

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.

SAS Innovate 2025: Register Today!

 

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.


Register now!

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
  • 2 replies
  • 842 views
  • 0 likes
  • 3 in conversation