Hello,
I am trying to use an INTNX function in my loop code but it doesn't accept reference to a field in my table. What can I replace the injury date with if i want to reference this specific date that is different on each row?
e.g.
%monthly_query1 ((INTNX('month',t1.Injury_Dte,0,'e')))
%monthly_query2 ((INTNX('month',t1.Injury_Dte,1,'e')))
%monthly_query2 ((INTNX('month',t1.Injury_Dte,2,'e')))
%monthly_query2 ((INTNX('month',t1.Injury_Dte,3,'e')))
%monthly_query2 ((INTNX('month',t1.Injury_Dte,4,'e')))
%monthly_query2 ((INTNX('month',t1.Injury_Dte,5,'e')))
Commas are the delimiters of parameters in macros. So the code you show the first comma is ending the parameter. I suspect that you may get errors related to more parameters than defined.
You likely need to quote the value that you want inside %str(<entirevalue goes here>) .
With t1. garbage I assume you are using this to write some SQL code.
You might consider using a data step where you can use a DO loop and an array to hold the values.
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.