Posts Tagged ‘ code ’

Calculate Net Promoter Score in PROC TABULATE

July 31, 2012
By

This demonstrates an easy way to calculate the Net Promoter Score, a measure of customer loyalty, in SAS’s PROC TABULATE. I prefer to use PROC TABULATE because of its power for various summaries. In the example we repeated the Net … Continu...
Read more »

Tags: , ,
Posted in SAS | Comments Off

Convert written numbers to Arabic numerals

March 22, 2012
By

In Natural Language Processing it can be helpful within a larger body of text to standardize written numbers to Arabic numerals. For example, we will change “I am forty-six years old” to “I am 46 years old,” so the age … C...
Read more »

Tags: , , ,
Posted in SAS | Comments Off

Checking return codes for errors in SAS

February 9, 2012
By

You should check for error return codes in any SAS programs that run unattended in batch jobs, so you can handle the exception properly. For example, if the data are invalid, you don’t want to generate reports or insert bad data into a database. ...
Read more »

Tags: , , , ,
Posted in SAS | Comments Off

Train neural network in R, predict in SAS

November 11, 2011
By

This R code fits an artificial neural network in R and generates Base SAS code, so new records can be scored entirely in Base SAS. This is intended to be a simple, elegant, fast solution. You don’t need SAS Enterprise Miner, IML, or any other spe...
Read more »

Tags: , , , , , ,
Posted in SAS | Comments Off

Logistic function macro for SAS

November 11, 2011
By

Used in logistic regression, neural networks, and countless other applications, the logistic function is simple to understand yet can be quirky to calculate in SAS because of how SAS treats extreme values. First, let’s consider the value -1000: R...
Read more »

Tags: , , ,
Posted in SAS | Comments Off

Model decision tree in R, score in SAS

October 11, 2011
By

This code creates a decision tree model in R using party::ctree() and prepares the model for export it from R to SAS, so SAS can score new records without invoking R. I use this method for several reasons. First, it’s convenient for my workflow t...
Read more »

Tags: , , , , , ,
Posted in SAS | Comments Off

Programmatically download monthly economic indicators

August 24, 2011
By

This SAS code programmatically downloads monthly economic indicators from FRED, and merges multiple time series into a single data set for convenient analysis. FRED (Federal Reserve Economic Data) is an excellent resource from the Federal Reserve Bank ...
Read more »

Tags: , , ,
Posted in SAS | Comments Off

Delete non-exact duplicates in SAS

May 12, 2011
By

When deleting non-complete duplicates in SAS, in each duplicate set you may want to keep a particular record identified by a rule: it may be the oldest, newest, first, or last observation in each set. You need a identifier to be unique, but you can&#82...
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.