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!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.