Entries in Programming (23)

SAS and Character Variable Lists

All this time I was doing things the hard way!

I new that a person could specify a range of variables, each with a numeric suffix, that SAS would enumerate over.  But I didn't think that it worked with character variables.

With variables with a number sequence suffix, typing the following is cumbersome:

proc freq data=mydata;
tables var1 var2 var3 var4 var5;
run;

Instead do this:

proc freq data=mydata;
tables var1-var5;
run;

The same technique can be used on variables with a character (alphabetical) sequence suffix, but you use two dashes instead of one:

proc freq data=mydata;
tables varA--varE;
run;

You can read more about Variable Lists on Paul Dickman's site.

Posted on Friday, January 23, 2009 by Registered CommenterJared in , | Comments2 Comments | References1 Reference

Turn ODS Results Off

If you ODS to a file but don't want to have SAS automatically open the file (such as RTF or HTML), you may find that adding the

ods noresults;

option above your ods file-type code may not work.

You need to go to Tools > Options > Preferences, then uncheck "View Results as they are generated" under the Results tab.

SAS Preferences Window

Posted on Friday, January 16, 2009 by Registered CommenterJared in , | CommentsPost a Comment

Convert from character to numeric and back using SAS

A recent SAS newsletter highlights how to Convert values from character to numeric or from numeric to character.  I thought this was one to add to my code snippets.

You can view it here.

 

 

Posted on Monday, December 22, 2008 by Registered CommenterJared in , | CommentsPost a Comment

Error on Installation of RadRails

I was upgrading the Aptana IDE which I use to program Ruby on Rails.  It's a fantastic product, but I was not impressed by the error I recieved while adding the RadRails plugin. 

I kept recieving an "operation has failed" error with no specific description as to why it failed. I would have guessed it was the server I was downloading the update from had I been unable to install the PHP plugin.

The fix is simple.  Just go to the Aptana Update Site to find the RadRails plugin zip file and follow the instructions to install.

Posted on Tuesday, December 9, 2008 by Registered CommenterJared in , , , | Comments2 Comments

If-then-else in SAS Macro

There is a great thread in the Google SAS group on If-then-else logic in SAS Macros.  It's a good read for n00bs.

Posted on Wednesday, December 3, 2008 by Registered CommenterJared in , | CommentsPost a Comment