BookmarkSubscribeRSS Feed
astha8882000
Obsidian | Level 7

Hello,

 

The aim of this code is just to get create a log file in the unix location but I've been getting this error.

 

These are the steps I've taken so far:

1. I checked the shared unix path to make sure I have access

2. Made sure the unix path is written correctly

3. made sure the folders were created and had read write rights.

4. I even created a dummy document but nothing seems to get rid of this error and the log displays nothing useful, just the below statements all over again.

 

All the posts in this forum regarding this error were mainly due to its usage in infile statement, so I couldn't find anything similar.

 

 Would appreciate some help

 

filename pswrdfile "some password file location" ;
data _null_ ;
           infile pswrdfile truncover;
           input line :$50.;
           call symputx('dtbspswrd',line);
     run ;
 

      %put & dtbspswrd ;

%let unix_path = some unix path location;
proc printto log = "&unix_path./log/prjname_log.txt"; 
run;


options nocenter source2 mlogic symbolgen nomprint;

Proc SQL;
CONNECT TO teradata (user="%sysget(USER)" password="& dtbspswrd." tdpid=aprtera mode=teradata); 
CREATE TABLE def as
Select * From connection to teradata
(SELECT top 10 * FROM some_table);
DISCONNECT FROM TERADATA;
QUIT;

proc contents data= def;
run;

proc printto; run;

 

Adding log:

 

GOPTIONS ACCESSIBLE;
filename pswrdfile "some password file location" ; data _null_ ; infile pswrdfile truncover; input line :$50.; call symputx('dtbspswrd',line); run ; NOTE: The infile PSWRDFILE is:
Filename = some password file location,
Owner Name = [my user id], Group Name = sasuser2,
Last Modified = 06Dec2018;11:36:54,
File Size (bytes) = 40

NOTE: 1 record was read from the infile PSWRDFILE.
The minimum record length was 40.
The maximum record length was 40.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
%put & dtbspswrd ; SYMBOLGEN: Macro variable DTBSPSWRD resolves to {Encrypted password}
%let unix_path = some unix path location;
proc printto log = "&unix_path./log/prjname_log.txt"; SYMBOLGEN: Macro variable UNIX_PATH resolves to 'some unix path location'

run; ERROR: Physical file does not exist, some unix path location/log/prjname_log.txt
NOTE: The SAS System stopped processing this step because of errors. options nocenter source2 mlogic symbolgen nomprint; Proc SQL; CONNECT TO teradata (user="%sysget(USER)" password="& dtbspswrd." tdpid=aprtera mode=teradata); CREATE TABLE def as Select * From connection to teradata (SELECT top 10 * FROM some_table);

NOTE: Table WORK.DEF created, with 13 rows and 700 columns
DISCONNECT FROM TERADATA; QUIT;
NOTE: PROCEDURE SQL used (Total process time):
real time 15.30 seconds
cpu time 0.04 seconds

proc contents data= def; run; proc printto; run;
19 REPLIES 19
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

Did you post your log with the errors?

you have a space after your ampersand

 

My first sujestion would be to change this:

password="& dtbspswrd."

to this:

password="&dtbspswrd."

astha8882000
Obsidian | Level 7

Space was a typo, I removed it, thanks. That didn't help with the error sadly. Also updated the logs. Thank you for your help.

Patrick
Opal | Level 21

@astha8882000

Make sure that the path....

some unix path location/log

 ....exists and is accessible out of the server context where your program executes from.

astha8882000
Obsidian | Level 7
Yes, this path exists and I can access it through winscp. Is there a way to check if or not I can access it through my code?
Patrick
Opal | Level 21

@astha8882000

If you execute the following code..

%put &unix_path./log;

...and then copy/paste the resolved path from the log 1:1 into WinSCP: Does this work?

 

Is the user you use with WinSCP the same than the one under which the SAS program executes?

 

 

astha8882000
Obsidian | Level 7
This is what I get when I try that: WARNING: Apparent symbolic reference UNIX_PATH not resolved.
astha8882000
Obsidian | Level 7
What can I do to sort out this warning?
astha8882000
Obsidian | Level 7
Ok so this warning is sorted. But the issue is still there 😞
Patrick
Opal | Level 21

@astha8882000 wrote:
Ok so this warning is sorted. But the issue is still there 😞

So have you tried:

...and then copy/paste the resolved path from the log 1:1 into WinSCP: Does this work?

astha8882000
Obsidian | Level 7
yes, I did the copy paste and it's accessible that way.

I tried another method, creating the log file on a temporary sasmart location and then do a x "cp command. The log file did get created but it's not copying over to the unix_path location.
Patrick
Opal | Level 21

@astha8882000

Read through what @Tom wrote. He's covering pretty much the possible root causes of why that's not working for you.

 

For testing: Instead of redirecting the log why don't you just first try with a simple filename statement writing "something" to the desired location. If that works then redirecting the log to such a location should work as well.

SASKiwi
PROC Star

Where is your SAS program running? On the same server as the Unix file paths or some other computer?

astha8882000
Obsidian | Level 7
It's running on the same server. All the other codes run the same way too so I feel okay about that part.
r_behata
Barite | Level 11

Try  inserting the "/" to before the macro variable , in case it does not resolve it along with  "&unix_path"

 

 

proc printto log = "/&unix_path./log/prjname_log.txt"; 
run;

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 19 replies
  • 2281 views
  • 1 like
  • 6 in conversation