BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
crawfe
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.

1 ACCEPTED SOLUTION

Accepted Solutions
7 REPLIES 7
Sam_SAS
SAS Super FREQ
Hello Ed,

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

Thanks,
Sam
crawfe
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.

Sam_SAS
SAS Super FREQ

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')

RETURN 1

ELSE 0

 

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

 

Would that work?

crawfe
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?).

Sam_SAS
SAS Super FREQ
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.
crawfe
Quartz | Level 8

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

Sam_SAS
SAS Super FREQ
Awesome! Glad to help 🙂

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning 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. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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
  • 1016 views
  • 0 likes
  • 2 in conversation