Hi All,
Help me to Solve below Syntax error,
Data dirlist3;
Set Dirlist2 ;
command="x 'copy "||'"'||strip(file_loc)||'" "||'"'||strip(file_to)||'"||"';";
call execute(command);
Run;
Log Says :
685
686 Data dirlist3;
687 Set Dirlist2 ;
688 command="x 'copy "||'"'||strip(file_loc)||'" "||'"'||strip(file_to)||'"||"';";
----------------------
22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =,
>, ><, >=, AND, EQ, GE, GT, LE, LT, MAX, MIN, NE, NG, NL, OR, ^=, |, ||, ~=.
689 call execute(command);
690 Run;
Your Will appreciate. thanks In advance.
Regards,
Dishant Parikh
="x 'copy "||'"'||strip(file_loc)||'" "'||strip(file_to)||'"'||" ';" ;
I think at this they are placed syntax correct. Probably you are needing a restart of the sas-session when you can not get out of the nesting issues.
The "magic string" could help you also. When using Eguide you will see that often as some start code.
You are trying to build an OS command. The call system interface it the one you could use within the datastep
you have several unbalanced apostrophes ' " in you statement causing the language interpreter going crazy. The first is after strip_loc.
Jaap,
Can you please provide me Correct Syntax for above problem,because statement causing the language interpreter going crazy for me as well.
Hi,
Thanks For your help,Problem solved
="x 'copy "||'"'||strip(file_loc)||'" "'||strip(file_to)||'"'||" ';" ;
I think at this they are placed syntax correct. Probably you are needing a restart of the sas-session when you can not get out of the nesting issues.
The "magic string" could help you also. When using Eguide you will see that often as some start code.
You are trying to build an OS command. The call system interface it the one you could use within the datastep
Hi,
Just to add as I run into these quotes all the time, there are functions out there to help reduce the complexity of the code. For example:
options xwait;
data tmp;
attrib command format=$2000.;
dir="s:\temp\rob\tmp.csv";
dir2="s:\temp\rob\xx";
command="x 'copy "||quote(dir)||" "||quote(dir2)||"';";
call execute(command);
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.