DATA Step, Macro, Functions and more

Produce automatically sasdata set under different name

Reply
Occasional Contributor
Posts: 15

Produce automatically sasdata set under different name

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;

Super User
Posts: 9,687

Produce automatically sasdata set under different name

You do not need || for macro variable.

%DO I=1 %TO 5;

     Data file&I;

Ksharp

Ask a Question
Discussion stats
  • 1 reply
  • 107 views
  • 0 likes
  • 2 in conversation