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

Hi. I am a new user to SAS VA 7.4. I have a field with 7 possible values A,B,C,D,E,F,G.

Each instance of UpNum can have only one of these values. There are multiple instances of the same UpNum.

I need to count the total times that A,C,E,F occur for each UpNum to be able to calculate

TOT#(ACEF) per #UpNum and use this in a bar chart or a table.


In this example: #UpNum(ACEF)(=1) for N1, (=2) for N2, etc. (I have been running into Datatype errors for the operators).


UpNum         Field Value                          Output

N1                     A                                  N1          #(ACEF)

N1                     B                                  N2          #(ADEF)

N1                     D                                  N3.....     #(ACEF)

N1                     G                                  N4....      #(ACEF)


N2                     C

N2                     G

N2                     A


Thank you for any advice.

Ed C.


Accepted Solutions
SAS Employee
Hello Ed,

What sort of syntax are you using here? It doesn't appear that this is VA expression syntax.

Quartz | Level 8

Hi. No, that is just my shorthand to describe what I am looking for. No syntax implied.

I am open to any suggestions of how to get to my output. #(ACEF) was just meant to say

that I need the sum of the counts of A, C, E, F for each UpNum value. Sorry for the confusion.

SAS Employee

Your original question is a little bit confusing -- how many variables are we talking about in your data?


Does your data look like this?


UpNum    X

N1            A

N1            C

N2            E

N2            F


If N1, N2, etc are in a separate column from the A B C D E F G values, then you could calculate something like this:


IF X in ('A', 'C', 'E', 'F')




Then you could make a table with just Upnum and your calculated item. Turn off detail data in the table properties.


Would that work?

Quartz | Level 8

Yes, in one column N1....Nn and in a separate column A-G.

This would be a new Calculated Measure? Why turn off Detail Data?


Thanks! Strategy question. Would this column be better created in the original table

or in SAS VA? (Is there a rule of thumb for this?).

SAS Employee
Yes, a calculated measure. You turn off Detail Data so that the values will be aggregated for each value of UpNum.

Generally speaking, it is simpler to calculate new items in your original table. SAS language, SQL syntax, etc. are much more robust than the expression editor syntax in Visual Analytics.

That said, I believe there are some aggregated calculations that can only be created in VA.
Quartz | Level 8

This worked just right! Thanks for helping me move toward the next experience level....

SAS Employee
Awesome! Glad to help 🙂



Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.


Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 


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
  • 7 replies
  • 2 in conversation