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.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
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.

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 2025 views
  • 0 likes
  • 4 in conversation