DATA Step, Macro, Functions and more

Filename is replaced with blank characters when using %sysexec copy

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Filename is replaced with blank characters when using %sysexec copy

Hello,

I am facing a problem with a code that has worked for me before. At the end of every job, I like to archive a copy of the sas codes that were used in the job using the following line:

%sysexec copy "&path.*.sas" "&Code_lib.*"/Y ;

 

where &path and &Code_lib are directory paths. 

The code executes but the resulting filenames in the &code_lib are like "           .sas", "          1_csv.sas" (see attached screenshot). Can somebody please give any pointers to solve this problem.

 

Here are some additional facts:

- &path and &code_lib are both mapped network drives

- &path is about 87 char in length

- &code_lib is about 130 char in length

- Longest sas file name string is 32 char in length

- Running SAS 9.4 on X64_10PRCapture1.JPG


Accepted Solutions
Solution
‎02-26-2018 12:32 PM
New Contributor
Posts: 3

Re: Filename is replaced with blank characters when using %sysexec copy

Posted in reply to indra1975

Withdrawing the question. I was able to solve the problem by configuring &path and &Code_lib using %let statement instead of a call symput. When using the latter the &path and &code_lib is set to the length as characterized in the dataset. Thank you for your attention.

View solution in original post


All Replies
Solution
‎02-26-2018 12:32 PM
New Contributor
Posts: 3

Re: Filename is replaced with blank characters when using %sysexec copy

Posted in reply to indra1975

Withdrawing the question. I was able to solve the problem by configuring &path and &Code_lib using %let statement instead of a call symput. When using the latter the &path and &code_lib is set to the length as characterized in the dataset. Thank you for your attention.

Super User
Super User
Posts: 7,860

Re: Filename is replaced with blank characters when using %sysexec copy

Posted in reply to indra1975

Unless you need to store leading and/or trailing spaces in your macro variables you should always use newer CALL SYMPUTX() function instead of CALL SYMPUT().

New Contributor
Posts: 3

Re: Filename is replaced with blank characters when using %sysexec copy

Thank you.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 101 views
  • 0 likes
  • 2 in conversation