BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dishant
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
jakarman
Barite | Level 11

="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

---->-- ja karman --<-----

View solution in original post

5 REPLIES 5
jakarman
Barite | Level 11

you have several unbalanced apostrophes  '   "  in you statement causing the language interpreter going crazy. The first is after strip_loc. 

---->-- ja karman --<-----
dishant
Calcite | Level 5

Jaap,

Can you please provide me Correct Syntax for above problem,because statement causing the language interpreter going crazy for me as well.

dishant
Calcite | Level 5

Hi,

Thanks For your help,Problem solved

jakarman
Barite | Level 11

="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

---->-- ja karman --<-----
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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-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
  • 5 replies
  • 1055 views
  • 0 likes
  • 3 in conversation