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,
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.
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.
Now we have our distinct counts!
Hope this helps!
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.
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.
Now we have our distinct counts!
Hope this helps!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.