06-24-2016 11:35 AM - edited 06-24-2016 12:22 PM
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
06-24-2016 04:49 PM
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.
06-28-2016 06:13 AM
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:
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