BookmarkSubscribeRSS Feed
vishu2
Fluorite | Level 6

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

4 REPLIES 4
SASKiwi
PROC Star

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.

vishu2
Fluorite | Level 6

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

FredrikE
Rhodochrosite | Level 12

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

vishu2
Fluorite | Level 6

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 4 replies
  • 913 views
  • 0 likes
  • 3 in conversation