DATA Step, Macro, Functions and more

call execute (%include "more than 262 lengths";)

Reply
Occasional Contributor
Posts: 5

call execute (%include "more than 262 lengths";)

Hi All,

The following is my original code:

data _null_;

   merge test1 (in=A)  test2 (in=B);

   by pgname;

   index="&inexpmg";

    if index="1"  then do;

        if A then      call execute (' %include " C:\Program Files\......\..........\..................\...\' ||pgname|| '  ";  '); end;

   if index="2" then do;

        if A & B then     call execute (' %include " C:\Program Files\......\..........\..................\...\' ||pgname|| '  ";  '); end;

   if index="3" then do;

        if A & ^B then      call execute (' %include " C:\Program Files\......\..........\..................\...\' ||pgname|| '  ";  '); end;

run;

However, I got the warning message

" WARNING: The quoted string currently being processed has become more than 262 characters long."

C:\Program Files\......\..........\..................\...\' ||pgname|| ' is longer than 262 characters.

This caused my including program did not process.

If I shorter my path in the testing situation, then the warning message will be gone and solved,

however, I can't shorter this path in the final version.

Also, I tried to use macro with do loop in it, however, the same error message came out. 

Does anyone have suggestions to me in this case?

I'll be very appreciate it!

Contributor
Posts: 60

Re: call execute (%include "more than 262 lengths";)

use the system option noquotelenmax; will supress the warning and code will execute.

Occasional Contributor
Posts: 5

Re: call execute (%include "more than 262 lengths";)

Posted in reply to Sudhakar_A

Hi Sudhakar_A,

I know "option noquotelenmax" can help to ignore the warning message, however, my program is still not working.

Thanks!

Contributor
Posts: 60

Re: call execute (%include "more than 262 lengths";)

you can store the path in the variable and concatenate with PGNAME then you can pass as a single variable to Cal execute. try this.

Or else

you have to use the relative path to include the file.

Regular Contributor
Posts: 227

Re: call execute (%include "more than 262 lengths";)

use a fileref:

filename Project "<path>";

%include Project(MyProgram);

Occasional Contributor
Posts: 5

Re: call execute (%include "more than 262 lengths";)

Posted in reply to Ron_Fehd_macro_maven

Hi Ron,

Thanks for suggestion.

I tested your method, but didn't work on my case.

Finally, I did them step by step, and get my result.

data loop;

   merge test1 (in=A) test2 (in=B);

   by pgname;

   index="&inexpmg";

   if index="1" then do;

        if A; end;

   if index="2" then do;

        if A & B; end;

   if index="3" then do;

        if A & ^B; end;

run;

proc sql noprint;

    select pgname into Smiley Tonguegnameok separated by " "

    from loop;

quit;

%macro loop;

%let i=1;

%let ds = %scan(&pgnameok.,&i.);

     %do %while ( &ds ^= () );

     %inc "C:\Program Files\......\..........\..................\...\\&ds..sas";

       %let i=%eval(&i+1);

     %let ds = %scan(&pgnameok.,&i.);

     %end;

%mend;

Thanks for everyone's join for creating different ideas Smiley Very Happy

Ask a Question
Discussion stats
  • 5 replies
  • 506 views
  • 0 likes
  • 3 in conversation