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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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