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

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, 

 

 


Screen Shot 2016-08-26 at 10.23.05 PM.png
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
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;

View solution in original post

4 REPLIES 4
ballardw
Super User

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.

drichmo1
Fluorite | Level 6

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. 

Ksharp
Super User
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;

drichmo1
Fluorite | Level 6

Thanks for your help! It worked!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2526 views
  • 2 likes
  • 3 in conversation