Google SAS Search

Add to Google

Wednesday, March 26, 2008

The Cats() Function

One of my favorite new functions is the cats() function available in SAS v9. It is a compress() like function in that it removes leading and
trailing blanks, but it also concatenates the results. CATS() stands for concatenate and strip. Basically the cats() function takes this
type of assignment statement:

key = trim(left(firstName)) || trim(left(lastName)) ||
trim(left(phone)) || trim(left(zip)) ;

and changes it to this:

key = cats(firstName, lastName, phone, zip);

Generally, the cats() function will return a value with a length of 32767 in the data step. So as always, it's a good idea to use
a length statement on the variable you are assigning to. In this example I might use something like:

length key $200;

The cats() function belongs to a family of cat() functions each doing it's own version of concatenate: cat(), cats(), catt(), catx().

Coming up in version 10, the dog() family of functions! :)

Tuesday, March 18, 2008

Blogging At the SAS Global Forum

So far so good at The SAS Global Forum.

I haven't had too much time to go to a lot of talks, but I attended a really informative one yesterday morning. Judy Loren from Health Dialog Analytic Solutions gave a good talk on using data step hash objects. One little code tidbit that caught my eye was this loop construct:

do i = 1 by 1 until( some criteria or i > 1000 );

It is a nice shorthand way to create a loop sentinel variable and update it instead of:

i = 0;
do until( some criteria or i > 1000 );
i + 1;

Nifty! You never know what little gems you can pick up from the Global Forum. Thanks Judy Loren.

Mostly I have been busy preparing for my own talk tomorrow morning (and enjoying St Paddy's Day on the riverwalk :).

I uploaded the paper and some accompanying code files in case you are interested.

More later!

Thursday, March 13, 2008

SAS Global Forum 2008

Howdy Ya'll!

I will be travelling to San Antonio, TX for SAS Global Forum 2008. I am not really there to "blog" the conference, but I will do my best to take some pictures and share my thoughts on different things I see there. Mostly I plan on wandering around, getting some free swag, meeting as many people as I can and having a good time. Oh, and I am presenting a paper "SAS Macros: Beyond the Basics" Wednesday morning at 10am :)

If you happen to see me there, please step forward and introduce yourself!