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

I want to SET temp&k and 'DATA Complete&i'

   %do k = 1 %to 100
   %do i = 1 %to 60

data complete&i

     set temp&k

K order(1 to 100) have to proceed the end of I(1 to 60) procedure

thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

To use the %do constructs it will need to be within an actual macro defined using %macro/%mend.

%macro example;

%do k = 1 %to 100;

     %do j= 1 %to 60;

     data complete&j;

          set temp&k;

     run;

     %end; /* ends the j loop*/

%end; /* ends the k loop*/

%mend;

And then call the defined macro:

%example;

I used k as I am tired of fighting with the editor about lower case "i".

View solution in original post

3 REPLIES 3
ballardw
Super User

To use the %do constructs it will need to be within an actual macro defined using %macro/%mend.

%macro example;

%do k = 1 %to 100;

     %do j= 1 %to 60;

     data complete&j;

          set temp&k;

     run;

     %end; /* ends the j loop*/

%end; /* ends the k loop*/

%mend;

And then call the defined macro:

%example;

I used k as I am tired of fighting with the editor about lower case "i".

COLDORANGE
Calcite | Level 5

Thank you so much.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

data complete&i.;

     set complet&i. temp&k.;

run;

Or you could use append.

I would ask though, why you have 100 complete tables and 60 temp tables, surely there are better methods to get the end result?

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1325 views
  • 0 likes
  • 3 in conversation