Sunday, March 14, 2010

To export dataset to excel with label

When we export SAS dataset to excel, we mostly do not like the actual variable name as column name in excel. Alternatively, variable label is more popular.
To export the label before SAS 9.2, we have to use LIBNAME with excel engine since it have many fine options to tune the output, e.g. DBLABEL, DBTYPE etc.

However, when the sheet is existing at that time, they can not be replaced automatically. That means you have to clean the file in advance.

In SAS 9.2, a new options is introduced: LABEL option in PROC EXPORT. The new option allow the output excel take label. Furthermore, PROC EXPORT support REPLACE functionality, that means we may avoid the code to clean the file.

No comments: