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.
I came across a nice PDF that further explains "Dash" and "Double-Dash" variable lists.
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
For some ODS tips, check out the ODS cheat sheet from SAS.
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.
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.
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.

