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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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