BookmarkSubscribeRSS Feed
Ramakanthkrovi
Obsidian | Level 7

This is a query on the basis of the following thread

 

https://communities.sas.com/t5/SAS-Visual-Analytics/Create-a-custom-category-in-SAS-VA-using-2-diffe...

 

I have a different issue compared to the one above. I need to create a custom category/ calculated item which is unique.

 

I have attached the screenshot to understand it better - In the bar chart, "Group" is a sum of all revenue across all regions (including APAC, Europe and Americas), APAC is just APAC and "Rest of the world" is Europe and Americas. They are all built off the same variable. I need to create a category/ calculated item to use in a bar chart and assign values accordingly.

 

 

screenshot.png

 

Of course the below code doesn't work but below is a sample of how I expect it to work.

 

 

IF ( 'Geo'n In ('APAC', 'Europe', 'North America', 'Enterprise') )
RETURN 'Group'
ELSE (
IF ( 'Geo'n = 'APAC' )
RETURN 'APAC'
ELSE 'Rest of the World'

 

6 REPLIES 6
SASKiwi
PROC Star

Looks like you are missing a bracket at least:

IF ( 'Geo'n In ('APAC', 'Europe', 'North America', 'Enterprise') )
RETURN 'Group'
ELSE (
IF ( 'Geo'n = 'APAC' )
RETURN 'APAC'
ELSE 'Rest of the World')
Ramakanthkrovi
Obsidian | Level 7

True, but that was what I put together quickly to help you understand the problem. Smiley Wink

 

Because I am including all values of 'Geo' to create 'Group' - the new calculated item will always have only one value - Group.

 

 

SASKiwi
PROC Star

Another reason this is not going to work is you have APAC both in the "GROUP" and as its own category. I suspect you will have to create two custom categories, one for GROUP, and another for APAC/Rest of World. Give it a try.

Ramakanthkrovi
Obsidian | Level 7

Exactly, that is the problem. I want to create a category which is custom and I already explained that in the initial question.

 

it is like writing 

sum(All geos) = "Group"

APAC = "APAC"

sum(all geos) - APAC = "RoW"

 

that is the custom category. is it possible in SAS VA?

SASKiwi
PROC Star

You can't sum a character column. I suggest you experiment with splitting your customer category into two separate ones as already discussed.

GertNissen
Barite | Level 11

Try

IF ( Geo= 'APAC' )
RETURN 'APAC'
ELSE 'Rest of the World'

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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
  • 6 replies
  • 1628 views
  • 0 likes
  • 3 in conversation