Statistical programming, matrix languages, and more

List of functions that operate on columns of a matrix

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

List of functions that operate on columns of a matrix

I've scanned the SAS/IML® 13.2 User’s Guide (UG) and didn't find a list of of functions that operate on the columns of an NxM array, returning a 1XM vector of results.

So I made this list:  CV  KURTOSIS  MEAN  MEDIAN  SKEWNESS  STANDARD  VAR

Did I miss any?   Is this list somewhere in the UG?


Accepted Solutions
Solution
‎05-20-2015 09:14 AM
Grand Advisor
Posts: 9,578

Re: List of functions that operate on columns of a matrix

Rick is absolutely right. But there are already some IML version of these function . Like :

x = {1 0,

2 1,

4 2,

8 3,

16 . };

kurt = kurtosis(x);

print kurt;

x = {5 1 10,

6 2 3,

6 8 5,

6 7 9,

7 2 13};

mean = mean(x);

print mean;

x = {1 3,

2 3,

4 9,

10 0};

med = median(x);

print med;

They are all column operation .

Xia Keshan

View solution in original post


All Replies
SAS Super FREQ
Posts: 3,408

Re: List of functions that operate on columns of a matrix

I assume you are primarily interested in descriptive statistics for each column. You can add the following functions:

COUNTMISS
COUNTN
COUNTUNIQUE
MAD
QNTL
QUARTILE

Also, subscript reduction operators enable you to perform columnwise operations:
SUM via x[+, ];
PROD via x[#, ];
MAX via x[<>, ];
MIN via x[><, ];
Index of maximum via x[<Smiley Embarassed, ];
Index of minimum via x[>:<, ];
SSQ via x[##, ];

Occasional Contributor
Posts: 14

Re: List of functions that operate on columns of a matrix

Rick -- thank you -- great reply -- this is exactly what I'm interested in.

BTW, I found QNTL last night going through your helpful tip sheet.

Grand Advisor
Posts: 9,578

Re: List of functions that operate on columns of a matrix

If I don't make a mistake, these data step function also could be applied to IML.

Check it at the bottom of IML documentation, you can find them all.

Ksharp

Message was edited by: xia keshan

Occasional Contributor
Posts: 14

Re: List of functions that operate on columns of a matrix

Xia -- I'm not sure I understand -- can you provide an example(s)?

SAS Super FREQ
Posts: 3,408

Re: List of functions that operate on columns of a matrix

All of the DATA step function are applied elementwise.  For example, if x is a matrix then y=sin(x) returns a matrix of the same size such that y[i,j] = sin(x[i,j]).  The OP is asking about functions that operate on each column of an (n x p) matrix and produce a (1 x p) vector of results.

Solution
‎05-20-2015 09:14 AM
Grand Advisor
Posts: 9,578

Re: List of functions that operate on columns of a matrix

Rick is absolutely right. But there are already some IML version of these function . Like :

x = {1 0,

2 1,

4 2,

8 3,

16 . };

kurt = kurtosis(x);

print kurt;

x = {5 1 10,

6 2 3,

6 8 5,

6 7 9,

7 2 13};

mean = mean(x);

print mean;

x = {1 3,

2 3,

4 9,

10 0};

med = median(x);

print med;

They are all column operation .

Xia Keshan

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 452 views
  • 6 likes
  • 3 in conversation