Contributor
Posts: 23

# Count Distinct by Group then Specific group percentage out of total on SAS VA (New SAS VA User)

I have a table (CustomerStatus) with two groups identified as Active and Inactive, I am trying to graph the total of active as a percentage of the overall population [Active/ (Active+Inactive) ]on SAS VA using a timeline and I am having some difficulties.

ie. January 89%, February 76% .......

SAS Employee
Posts: 19

## Re: Count Distinct by Group then Specific group percentage out of total on SAS VA (New SAS VA User)

[ Edited ]

Hello chrisjab,

With the timeline that you want to use, is your date variable recognized as a category or a date/time value? In addition, are there two distinct variables for Inactive and Active? What variables does your table include? If you could specify what your table includes or attach a screenshot to your reponse it would be much appreciated.

Best,

Meredith Bailey

Contributor
Posts: 23

## Re: Count Distinct by Group then Specific group percentage out of total on SAS VA (New SAS VA User)

Thank you Meredith,

My data set consists of CustomerNumber, CustomerName, CustomerStatus (Active/Inactive), TransactionDate (mm/dd/yyyy), Transaction Amount (Dollar).

I am getting my tables summarized on SAS EG to transfer them to SAS VA for reporting. Since there are multiple transactions per customer, I am unable to graph the total number of unique customers based on their status (Active/Inactive). For Example: CustomerNumber 456987 is identified as Active however since he had 5 transactions he's coming up 5 times. On SAS VA I want to make sure that he's unique (as well as all other customers with multiple transactions)

How can I do that given that my ultimate goal is to create a pie showing the % of inactive vs. Active ?

Contributor
Posts: 55

## Re: Count Distinct by Group then Specific group percentage out of total on SAS VA (New SAS VA User)

[ Edited ]

Hi Chris,

My 5 cents:

You can create a distinct count of customer Number category.

Splits the active/inactive customers in 2 different categories (set the other part of a category to missing value)

Create distinct counts on those categories

Create a new aggregated measure like this:

Distinct [_ByGroup_] ('Active Customer Number'n)  / Distinct [_ByGroup_] ('Customer Numer'n)

This should give you a percentage active customers.

Discussion stats
• 3 replies
• 924 views
• 1 like
• 3 in conversation