BookmarkSubscribeRSS Feed
Yondori
Calcite | Level 5

Hi

While running SAS for my research, I have
some problem with ‘MACRO’ things. So, anyone who know how to solve my problem
please help me.

I want to find the ‘decay parameter’ which
results the maximum concurrent rate in logistics regression model. And before
that I need to make some dataset which differ according to its decay parameter

Here’s my original codes

%macro m2;

data ana2_macro; set ana2;

decay=0. 1;

       F2=d0_log_count*decay+d1_log_count;

       T2=d0_H_PV*decay+d1_H_PV;

       E2=d0_spd*decay+d1_spd;

       Sq_E2=d0_spd_sq*decay+d1_spd_sq;

run;

%mend m2;

And the problem is I want to make decay from 0.1 to 1 (0.1, 0.2, 0.3 …) automatically by using &n or something, but I don’t
know how to make it. So, can you give me some advice on this?

Thanks

2 REPLIES 2
Reeza
Super User

Why do you need a macro for that? Use a do loop and then process using a by variable.

data ana2_macro;

set ana2;

do decay=0.1 to 0.5;

       F2=d0_log_count*decay+d1_log_count;

       T2=d0_H_PV*decay+d1_H_PV;

       E2=d0_spd*decay+d1_spd;

       Sq_E2=d0_spd_sq*decay+d1_spd_sq;

output;

end;

run;

Rick_SAS
SAS Super FREQ

For a related discussion of macro processing versus BY-group processing, see the article Simulation in SAS. (Bonus: It includes a comment from Reeza!)

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1575 views
  • 0 likes
  • 3 in conversation