BookmarkSubscribeRSS Feed
AleksandraGav
Calcite | Level 5

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')))

2 REPLIES 2
Reeza
Super User
You need to provide more details.
Starting with the actual macro and how the parameter is being used. You may want to look at CALL EXECUTE and use a loop within a data step if you want to call the same macro multiple times.
ballardw
Super User

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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