Problem Note 55393: The IMSTAT procedure updates all records if there are uninitialized variables in the CODE= program
If you specify the CODE= option in an UPDATE statement and there are uninitialized variables in the SAS® program, PROC IMSTAT updates every record in the target table. To avoid unintended updates, you should initialize all variables introduced in the user supplied SAS program. To initialize a variable, use a FORMAT statement, a LENGTH statement, or an assignment statement. (This does not apply to variables already in the active table being updated.)
Failure to initialize a variable can result in all records being updated. There are no notes in the SAS Log to indicate this has happened.
Here is an example. Suppose we load the SAS data set Sashelp.cars to LASR and run the following,
proc imstat;
table lasr.cars;
UPDATE / code=pgm1;
quit;
where pgm1 is a fileref to a text file. Suppose the text file includes the following line of code:
if manufacturer="Mazda" then origin="Japan";
Since MANUFACTURER does not exist in Sashelp.cars, the value of ORIGIN is updated to "Japan" in every record of Lasr.cars.
To avoid this problem, initialize the variable MANUFACTURER in the SAS program using any of the following methods:
format manufacturer $10;
if manufacturer="Mazda" then origin="Japan";
length manufacturer $10;
if manufacturer="Mazda" then origin="Japan";
manufacturer = "Ford";
if manufacturer="Mazda" then origin="Japan";
For related notes about using the CODE= option in the UPDATE statement in PROC IMSTAT, see Problem Note 55419
and Problem Note 55420.
Operating System and Release Information
SAS System | SAS LASR Analytic Server | Microsoft® Windows® for x64 | 9.4 TS1M2 | 9.4 TS1M3 |
64-bit Enabled AIX | 9.4 TS1M2 | 9.4 TS1M3 |
64-bit Enabled Solaris | 9.4 TS1M2 | 9.4 TS1M3 |
Linux for x64 | 9.4 TS1M2 | 9.4 TS1M3 |
Solaris for x64 | 9.4 TS1M2 | 9.4 TS1M3 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
If a variable is specified in a CODE= program and that variable does not exist in the data set, the UPDATE statement in PROC IMSTAT updates all records in the data set. This is most likely an unintended consequence, and there are no log messages to indicate this has happened
Type: | Problem Note |
Priority: | high |
Topic: | Analytics ==> analytics SAS Reference ==> Procedures ==> IMSTAT
|
Date Modified: | 2016-06-15 12:16:08 |
Date Created: | 2015-03-17 15:30:14 |