BookmarkSubscribeRSS Feed
CathyVI
Pyrite | Level 9

I found this macro  online and I may be useful for my analysis but when I tried to run it as it is, its not working. Anyone knows why?

Here is the link: https://dlin.web.unc.edu/software/hazardratio/

%macro HazardRatio (Data = Data, Time = Time, Status = Status, Stratum =, Treatment = Treatment, Alpha = 0.05, Accuracy = 0.001, Result = HR_CI);

……
%mend HazardRatio;

data test;
input Treatment Stratum Time Status;
datalines;
1 2 1521 1
1 1 1537 0
0 2 963 1
1 2 293 1
0 2 659 1
1 2 1767 1
0 1 1865 0
1 1 1792 0
1 1 1841 1
0 1 1845 1
0 1 1888 1
0 1 1701 1
1 1 887 1
0 1 1918 1
1 1 1822 1
1 1 1638 1
0 1 1772 1
0 2 384 1
0 2 218 1
1 1 1775 1
1 1 1526 1
0 1 1745 1
0 1 1788 1
1 1 1387 1
;
run;
%score_bound(Data = test, Time = Time, Event = Event, Stratum = Stratum,
Treatment = Treatment, Alpha = 0.05, Accuracy = 0.000001);

 

>>>>>>>>>>>>This is the log>>>>>>>>>>>>

294 %macro HazardRatio (Data = data, Time = Time, Status = Status, Stratum =, Treatment = Treatment,
294! Alpha = 0.05, Accuracy = 0.000001, Result = HR_CI);
295
296 %mend HazardRatio;
297 data test;
298 input Treatment Stratum Time Status;
299 datalines;

NOTE: The data set WORK.TEST has 24 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.28 seconds
cpu time 0.12 seconds


WARNING: Apparent invocation of macro SCORE_BOUND not resolved.
324 ;
325 run;
326 %score_bound(Data = test, Time = Time, Event = Event, Stratum = Stratum,
-
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

327 Treatment = Treatment, Alpha = 0.05, Accuracy = 0.000001);

 

2 REPLIES 2
ballardw
Super User

Where is the macro SCORE_BOUND defined?

You call it after your data step but do not show where it is defined.

 

If the macro Hazardratio calls the macro Score_bound, which we can't see because you did not include the code, then you need to compile that macro before running Hazardratio.

 

You will want to get in the habit of setting OPTIONS MPRINT; before attempting to debug macro behavior. That will show more details of what SAS statements the macro is generating and then error messages usually make more sense in context.

 

 

pink_poodle
Barite | Level 11

This macro is from 2016. Maybe it was already made into a SAS procedure?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 428 views
  • 3 likes
  • 3 in conversation