How would I be able to take the frequencies in matrix. For the data I am using I have colums A, B, C, D, E., however, they do not represent different variables, so I do not want to know the frequency of each unique entry per column, but rather, the frequency of each unique entry for the matrix as a whole.
Attatched is the matix.
Best,
Yes. It is IML thing. data have; input a b c d e; cards; 1 2 3 6 2 3 4 7 1 . 2 . . 3 6 ; run; proc iml; use have; read all var{a b c d e} into x; close; call tabulate(level,freq,x); print (level`)[l='level'] (freq`)[l='freq']; quit;
And the output should look like what for that example data?
It isn't clear if you are looking for an overall frequency from the entire dataset or per row only.
Also are those the only values that will ever appear among the variables or do you have the possibility of practically unlimited actual values for A B C D and E?
Since you are using the word "matrix" this might be better as a SAS/IML question.
I want to take the frequency if the whole dataset and I do not want the output to give me the out put based on A B C D E. They mean nothing for my data.
Yes. It is IML thing. data have; input a b c d e; cards; 1 2 3 6 2 3 4 7 1 . 2 . . 3 6 ; run; proc iml; use have; read all var{a b c d e} into x; close; call tabulate(level,freq,x); print (level`)[l='level'] (freq`)[l='freq']; quit;
Thanks for your help! It worked!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.