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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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