I'm wondering if there is anyway to do a calculation by specific groups within the same column of data.
If I have the following data set, I want to be able to sum the Count column by Status then divide the sum of sold status count by the sum of proposed status count. Is this possible is VA?
I know I can manipulate the data prior to bring it into VA and columns for 'Sold Count' and 'Proposed Count' and would be able to do the calculation that way, just curious if there is another way.
I think you need to create two calculated items one for each status and then create a calculation between them
Var 1: if status = 'sold' then count else . | Aggregation = count.
Var 2: if status = 'proposed' then count else . | Aggregation = count.
Var 3: var 1 / var 2
I have not seen any example (yet) on how to do it using just one column 🙂
View solution in original post
Ah yes, that works. Didn't think to do the counts in VA. Perfect!
Just for reference, here is the actual text that is working for me:
IF ( 'STATUS'n In ('SOLD') )RETURN 'COUNT'nELSE 0
SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
Submit your idea!
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.