BookmarkSubscribeRSS Feed
telescopic
Calcite | Level 5

Hi, I am trying to use macro to produce automatically sasdata set under name: file1,file2,...file5 each which will contain a time series. The following code does't produce those 5 sets. Can someone suggest a solution? 

Thank you

---------------------------------

%MACRO TS;

%DO I=1 %TO 5;

     Data file||&I;

     w=0;

     DO t=0 to 100;

     money=rannor(0);

     w=money+w;

     x=0.3*t+w;

     output;

     END;

     RUN;

%END;

%MEND TS;

%TS;

1 REPLY 1
Ksharp
Super User

You do not need || for macro variable.

%DO I=1 %TO 5;

     Data file&I;

Ksharp

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 882 views
  • 0 likes
  • 2 in conversation