BookmarkSubscribeRSS Feed
firefly
Calcite | Level 5

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!

5 REPLIES 5
Sudhakar_A
Calcite | Level 5

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

firefly
Calcite | Level 5

Hi Sudhakar_A,

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

Thanks!

Sudhakar_A
Calcite | Level 5

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.

Ron_MacroMaven
Lapis Lazuli | Level 10

use a fileref:

filename Project "<path>";

%include Project(MyProgram);

firefly
Calcite | Level 5

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 :pgnameok 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 😄

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1391 views
  • 0 likes
  • 3 in conversation