Overview
During a recent SAS migration exercise to SAS 9.3 on Linux we were faced with hundreds of SAS Data Step Views that were created in SAS 9.1. Because the Views did not have their source code saved when they were originally created, we were faced with having to start up the previous version of SAS and describe each view. Then we could re-run that code to re-create the view in 9.3.
Describing a SAS 9.1 view without leaving SAS 9.3
As inferred in the above overview, this method and code were created to solve a specific problem on Linux - although it may be possible to modify the code to run on another operating system. Due to the large number of Views, and the volume of "black box" code that was being run, it was difficult to identify before-hand which Views needed to be updated. When some code referenced an old View, the following ERROR would appear:
WARNING: File MART.SALES_VIEW.VIEW was created for a different operating system.
ERROR: The view MART.SALES_VIEW was created on an incompatible host and cannot execute on this host.
The macro we created allows us to stay in SAS 9.3 (in our case via Enterprise Guide) to describe the older view as we come across it by issuing the following macro call:
%describe_view(VIEW_LIBRARY=mart, VIEW_NAME=sales_view);
This call would output the following lines to the SAS log:
******************************************************************************** * View: sales_view * * Location: /data/production/datamart ******************************************************************************** * Libname statement: *; * LIBNAME mart '/data/production/datamart'; ********************************************************************************; data mart.sales_view / view= mart.sales_view; merge mart.sales_fact(in=a where=(today()-30 le sales_date le today())) mart.customer(in=b); by customer_id; if a and b; run;
The SAS user can then take the provided code and run it in SAS 9.3 to create the new view in SAS 9.3.
The macro takes the following three parameters:
Parameter | Description | Notes |
---|---|---|
VIEW_LIBRARY |
The LIBREF containing the View (as allocated in the current 9.3 session) |
Required |
VIEW_NAME | The name of the View | Required |
SAS_BIN | The absolute path to the older SAS binary, e.g. /usr/local/SAS_9.1/sas | Optional |
Comments
0 comments
Article is closed for comments.