Hi,
I am stuck on an issue when I try to write a filter. The program doesn't log me errors, but the filter is not taken into account.
I have 3 data:
# one date prompt named "pm"
# one date named "initial_date"
# one number named "duration"
I want to select only rows where the end of the month of initial_date+duration (months) >= pm
The filter I wrote is this one:
WHERE %_eg_WhereParam( INTNX('month', INITIAL_DATE, + DURATION , 'e'), PM, GE, TYPE=D, IS_EXPLICIT=0 );
Can you tell me where the mistake is?
Thank you by advance
Your prompts are macro variables, you need to reference them with a & in front.
WHERE %_eg_WhereParam( INTNX('month', &INITIAL_DATE, &DURATION , 'e'), PM, GE, TYPE=D, IS_EXPLICIT=0 );
I can't guarantee that will work since I don't know what the parameters look like or your data. They do have to line up and the code generated needs to be valid SAS code.
You don't need the + sign in front of duration.
Usually in macros you don't have the parameters in quotes (month and e) but I'm not familiar with the EG filter macro being used.
Hopefully this helps get you started.
Thank you for your answer but yo misunderstood:
My prompt is PM, Initial_date and duration are data gotten from a previous task.
Did you try the method with PM? What does your filter look like now?
%put &8pm;
Hey Reeza,
I've tried differently but always the same problem...
When I put PM, I have the result expected, that means "31MAY2016"
Now I have calculated on the previous task a new data:
*DT_END
which is equals to
INTNX('month', INITIAL_DATE, + DURATION , 'e')
This is working.
So on my filter I do:
WHERE %_eg_WhereParam( DT_END, PM, GE, TYPE=D, IS_EXPLICIT=0 );
And still with this, it's like I have not written this filter...It output all rows not only those where DT_END >= PM
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.