BookmarkSubscribeRSS Feed
AJ_Brien
Quartz | Level 8

Hello,

 

I have a dataset in the unix location by the name 'db_&cur_mon.' where cur_mon is a macro variable which gets the value MONYY. This dataset gets generated each month, and every month I need to copy the current months' dataset from its unix location to a windows shared drive location.

 

This is the function that I'm using (attached), but I get this error:

ERROR: File /unix link/TEMP/YES/db_&cur_mon..sas7bdat not a valid file

 

I'm assuming it's because I shouldn't be using a macro variable but am not sure how else can I perform this operation.

Appreciate all helping me understand this concept. Thank you! 

 

%let abc=/unix link/TEMP/YES;
%let win=\\shard drive windows location\PILOT;
%SYSRPUT win=&win.;

 

Capture.PNG

6 REPLIES 6
AJ_Brien
Quartz | Level 8
I made some changes and this is what I did:



%let path_unix=unix path;
%SYSRPUT path_unix=&path_unix.;
%let path_win = \\windows shared drive path;
%SYSRPUT path_win=&path_win.;
%let MON = %sysfunc(intnx(month, %sysfunc(today()),0), monyy5.);
%SYSRPUT MON=&MON.;



Now when I use the copy task to move my dataset from &path_unix./ABC_&mon..sas7bdat to &path_win.

it gives me the error:

ERROR: Object reference not set to an instance of an object.
ChrisHemedinger
Community Manager

@AJ_Brien Do you have a log from the Copy Files task?  If not, you might need to enable Application Logging (Tools->Options) to get a detailed log, and work with SAS Tech Support on this.

 

One other thing to try -- map a drive to your UNC path (\\server\path\file) and use the mapped drive instead of the "\\" notation.

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
Tom
Super User Tom
Super User

What remote SAS/Connect session do you think the %SYSRPUT statement is going to execute in?

Did you actually run those %LET statements in the current SAS session before trying to run the copy task?

AJ_Brien
Quartz | Level 8

So I made some changes and this is what I did:

 

%let path_unix=unix path;
%SYSRPUT path_unix=&path_unix.;
%let path_win = \\windows shared drive path;
%SYSRPUT path_win=&path_win.;
%let MON = %sysfunc(intnx(month, %sysfunc(today()),0), monyy5.);
%SYSRPUT MON=&MON.;

 

Now when I use the copy task to move my dataset from &path_unix./ABC_&mon..sas7bdat to &path_win.

it gives me the error:

ERROR: Object reference not set to an instance of an object.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 6 replies
  • 1578 views
  • 0 likes
  • 4 in conversation