BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Betty_sam
Obsidian | Level 7

Hi all,

I need to calculte this : distinct(value) where nb>1 as a calculated element but it seems impossible in SAS VA 

Please help me out with this issue.

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
Stu_SAS
SAS Employee

Hi @Betty_sam! Here's a quick way to do it using sashelp.cars as an example. We're going to do create a distinct count of all Makes > 200 horsepower.

 

1. Create a new calculated item of your category

The below code will act as a filter:

if('Horsepower'n > 200) return 'Make'n 
else ''

 

2. Create a new distinct count on your new calculated item

Right-click your new data item, select "New Calculation," and "Distinct Count." This should already be selected for you.

 

Stu_SAS_0-1647028823789.png

3. Add your calculation to an object and filter out missing values

The distinct function also includes missing values. We want to remove those, so we'll filter that out in our object by removing any missing values of our new Make calculation.

 

Stu_SAS_2-1647028941075.png

 

Now we have our distinct counts!

Stu_SAS_3-1647029136990.png

Hope this helps!

 

View solution in original post

2 REPLIES 2
Stu_SAS
SAS Employee

Hi @Betty_sam! Here's a quick way to do it using sashelp.cars as an example. We're going to do create a distinct count of all Makes > 200 horsepower.

 

1. Create a new calculated item of your category

The below code will act as a filter:

if('Horsepower'n > 200) return 'Make'n 
else ''

 

2. Create a new distinct count on your new calculated item

Right-click your new data item, select "New Calculation," and "Distinct Count." This should already be selected for you.

 

Stu_SAS_0-1647028823789.png

3. Add your calculation to an object and filter out missing values

The distinct function also includes missing values. We want to remove those, so we'll filter that out in our object by removing any missing values of our new Make calculation.

 

Stu_SAS_2-1647028941075.png

 

Now we have our distinct counts!

Stu_SAS_3-1647029136990.png

Hope this helps!

 

Betty_sam
Obsidian | Level 7
Hi @Stu_SAS,
Thank you very much for your response.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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
  • 2 replies
  • 2391 views
  • 1 like
  • 2 in conversation