SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 41619: Using PROC FORMAT in conjunction with PROC SQL to access a database gives different results between SAS® 9.1.3 and SAS® 9.2

DetailsHotfixAboutRate It

Doing a query in SAS 9.1.3 against a Microsoft SQL Server table using SAS/ACCESS® Interface to Microsoft SQL Server returns correct results. SAS/ACCESS Interface to Microsoft SQL Server in SAS 9.2 passes a substring function, which returns an incorrect result. Using the LIBNAME option DIRECT_SQL=NOWHERE does not have an effect on the results. The following code produces different results between SAS 9.1.3 and SAS 9.2.

proc format; value $target '12345678'='*' '67890123'='*'; run; options sastrace=',,,d' sastraceloc=saslog nostsuffix; proc sql details="reduce_put_bench$" _tree; create table work.tmp as select * from test.awh_phone2 AS Phone_phone where put(Phone_phone.s_phone,$target.) = '*'; quit;

SAS 9.1.3 generates the following code:

SQLSRV_2: Prepared: SELECT "s_phone", "r_phone", "date_time", "Duration" FROM "awh_phone2"

SAS 9.2 generates this code:

SELECT "s_phone", "r_phone", "date_time", "Duration" FROM "awh_phone" WHERE ( ( ({fn SUBSTRING( "s_phone", 1, 1)} IN ( '12345678' , '67890123' ) ) ) OR ( ({fn SUBSTRING( "r_phone", 1, 1)} IN ( '12345678' , '67890123' ) ) ) OR ({fn SUBSTRING( "s_phone", 1, 1)} = '*' ) OR ({fn SUBSTRING( "r_phone", 1, 1)} = '*' ) )

The workaround is to change the format as follows:

proc format; value $target(default=8) '12345678'='*' '67890123'='*'; run;

Click the Hot Fix tab in this note to access the hot fix for this issue.



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS/ACCESS Interface to Microsoft SQL Server64-bit Enabled AIX9.2 TS2M39.3 TS1M0
64-bit Enabled HP-UX9.2 TS2M39.3 TS1M0
64-bit Enabled Solaris9.2 TS2M39.3 TS1M0
HP-UX IPF9.2 TS2M39.3 TS1M0
Linux9.2 TS2M39.3 TS1M0
Linux for x649.2 TS2M39.3 TS1M0
Solaris for x649.2 TS2M39.3 TS1M0
* 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.