Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

How to limit number of Months in SAS VA 7.4?

Reply
Occasional Contributor
Posts: 7

How to limit number of Months in SAS VA 7.4?

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

Super User
Posts: 4,013

Re: How to limit number of Months in SAS VA 7.4?

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.

Occasional Contributor
Posts: 7

Re: How to limit number of Months in SAS VA 7.4?

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

PROC Star
Posts: 391

Re: How to limit number of Months in SAS VA 7.4?

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 Smiley Happy

//Fredrik

Occasional Contributor
Posts: 7

Re: How to limit number of Months in SAS VA 7.4?

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

Ask a Question
Discussion stats
  • 4 replies
  • 151 views
  • 0 likes
  • 3 in conversation