Hi Everyone,
I have one column name "month" which has 31 months
what i want to do is i want to limit number of months
for example :- Current Month followed by two future months and two previous month followed by current month
Like if current month is April then it has to show something like
FEb-MAR-APR(Current month)-MAY- JUN
Any one know, How we can do it in SAS VA 7.4?
Thanks in advance
One easy way to deal with this is to add a numeric month identifier variable to your data prior to loading into VA. Set current month data to 0, last month data to -1 and so on. Set next month +1 and so on. If you have a reporting date in your data it is easy to create this variable:
Month_Counter = intck('MONTH', today(), reporting_date);
You can then use the Month_Counter as a filter in all of your reports. For example where Month_Counter between -2 and +2 will select the months you want.
Hi,
I tried but not getting it, how to do it as I don't have any reporting date and my month is in char format to convert it to date, I am using following code
input(month, dtdtm.) as new_month format=dtdate9.,
and how I will create the month identifier for it?
I am new to it
Thanks
vish
HI!
Try this:
- Convert the character date to sas date using your input function. Lets say you call it date_num
- create a new date variabel which is 2 months greater than the new date variable using intnx('month',date_num,2). Lets say you call it date_num_plus2
- in VA create a prompt on date_num_plus2. Add a date parameter and assign it to the prompt.
- Create a data filter that selects month <= the parameter.
- In your visualizations use rank and pick the highest 6 on date_num.
Some work, but I think it would work 🙂
//Fredrik
No requirement is little different.
I am using cross Tab and I want to filter it there and it should change automatically for every current month.
like
if May is (Current month)
then it should show Feb-mar-apr(3 previous months)
and Jun-July(2 future months)
So in addition likewise it should change automatically for every current month without doing any changes.
Right now.
I created two fields min date and max date
with code
intnx('month',input(metric_month,anydtdte20.),-3) as min_date format=date9.,
intnx('month',input(metric_month,anydtdte20.),+2) as max_date format=date9.,
and when i am filtering it in cross tab using "month between incl max & min" its not filtering the months
Thanks
Vish
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.