SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 55393: The IMSTAT procedure updates all records if there are uninitialized variables in the CODE= program

DetailsAboutRate It

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

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS LASR Analytic ServerMicrosoft® Windows® for x649.4 TS1M29.4 TS1M3
64-bit Enabled AIX9.4 TS1M29.4 TS1M3
64-bit Enabled Solaris9.4 TS1M29.4 TS1M3
Linux for x649.4 TS1M29.4 TS1M3
Solaris for x649.4 TS1M29.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.