BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Kamohelo
Fluorite | Level 6
Hi.

I would like to create a distinct count from a category data item as a measure. I would want to use this in a calculation. Is this possible to achieve within VA?
1 ACCEPTED SOLUTION

Accepted Solutions
acordes
Rhodochrosite | Level 12

I cannot access sas viya in these moments. 

But the steps are:

  1. create distinct count of your categorical variable
  2. create an aggregation of your table (go to data, choose your table, right click on create aggregation of this table)
    1. select your variables of interest plus the distinct count variable
  3. once created the new aggregated table create calculated measure using the distinct count variable which had been transfered from the original table. now it behaves like a measure

View solution in original post

6 REPLIES 6
acordes
Rhodochrosite | Level 12

I think after creating the count distinct variable you'll need to "fix" it by creating an aggregated table with this variable. 

The aggregated table allows you to make calculations with it, in the original table it will result most likely in an error saying "you cannot do this with a aggregated measure"

 

this trick iften helps.

Kamohelo
Fluorite | Level 6

Hi acordes

 

I have created a new distinct count from my ID category. and it has placed it under aggregate measure. I now created a new calculated item using aggregate table. I am getting errors. I am not sure if i am doing it the correct way. 

Kamohelo_0-1633683058890.png

 

Your assistance is greatly appreciated

acordes
Rhodochrosite | Level 12

That's what I meant when saying that it will throw out an error.  

You have to make an aggregated table carrying over this newly created distinct count variable (plus the other variables you need). 

There you can use it as a static variable in your calculations. 

 

Kamohelo
Fluorite | Level 6

Hi Acordes

 

Can you provide me with an example on how to perform this?

 

 

acordes
Rhodochrosite | Level 12

I cannot access sas viya in these moments. 

But the steps are:

  1. create distinct count of your categorical variable
  2. create an aggregation of your table (go to data, choose your table, right click on create aggregation of this table)
    1. select your variables of interest plus the distinct count variable
  3. once created the new aggregated table create calculated measure using the distinct count variable which had been transfered from the original table. now it behaves like a measure
jtelesco70
Calcite | Level 5

In older versions of SAS you didn't have to create a whole different data table just to create a simple distinct count.  There should be an easier way to do this.

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