Posts Tagged ‘ Getting Started ’

Access rows or columns of a matrix by names

October 1, 2012
By
Access rows or columns of a matrix by names

Did you know that you can index into SAS/IML matrices by using unique strings that you assign via the MATTRIB statement? The MATTRIB statement associates various attributes to a matrix. Usually, these attributes are only used for printing, but you can also use the ROWNAME= and COLNAME= attributes to subset
Read more »

Tags: , ,
Posted in SAS | Comments Off

Filling the lower and upper triangular portions of a matrix

September 17, 2012
By
Filling the lower and upper triangular portions of a matrix

If you use a word three times, it's yours. -Unknown When I was a child, my mother used to encourage me to increase my vocabulary by saying, "If you use a word three times, it's yours for life." I believe that the same saying holds for programming techniques: Use a
Read more »

Tags: , ,
Posted in SAS | Comments Off

Construct the equation of a line: An exercise in string concatenation

September 4, 2012
By
Construct the equation of a line: An exercise in string concatenation

I needed to construct a string to use in the title of a scatter plot. The scatter plot showed a line, and I wanted to include the equation of the line in the plot's title. This article shows how to construct a string that contains the equation in a readable
Read more »

Tags: ,
Posted in SAS | Comments Off

The MOD function and negative values

August 27, 2012
By
The MOD function and negative values

When I studied math in school, I learned that the expression a (mod n) is always an integer between 0 and q – 1 for integer values of a and q. It's a nice convention, but SAS and many other computer languages allow the result to be negative if a (or q) is
Read more »

Tags: ,
Posted in SAS | Comments Off

How to return multiple values from a SAS/IML function

August 20, 2012
By

The SAS/IML language supports user-defined functions (also called modules). Many SAS/IML programmers know that you can use the RETURN function to return a value from a user-defined function. For example, the following function returns the sum of each column of matrix: proc iml; start ColSum(M); return( M ); /*
Read more »

Tags: , ,
Posted in SAS | Comments Off

Suppress variable labels in SAS procedures

August 13, 2012
By
Suppress variable labels in SAS procedures

Sometimes a small option can make a big difference. Last week I thought to myself, "I wish there were an option that prevents variable labels from appearing in a table or graph." Well, it turns out that there is! I was using PROC MEANS to display some summary statistics, and
Read more »

Tags: , ,
Posted in SAS | Comments Off

Change a plot title by using the ODS Graphics Editor

August 6, 2012
By
Change a plot title by using the ODS Graphics Editor

A comment to last week's article on "How to get data values out of ODS graphics" indicated that the technique would be useful for changing the title on an ODS graph "without messing around with GTL." You can certainly use the technique for that purpose, but if you want to
Read more »

Tags: , ,
Posted in SAS | Comments Off

The power operators: Powers of matrices and matrix elements

July 30, 2012
By
The power operators: Powers of matrices and matrix elements

I received the following question: In the DATA step I always use the ** operator to raise a values to a power, like this: x**2. But on your blog I you use the ## operator to raise values to a power in SAS/IML programs. Does SAS/IML not support the **
Read more »

Tags: , ,
Posted in SAS | Comments Off

Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.