BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. 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.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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