Problem Note 4449: SCAN function returns incorrect result
The SCAN function produces incorrect results in Version 8 of SAS when
the second argument is negative and the result is longer than the
target variable. For example:
data _null_;
length char8 $8 char6 $6 char5 $5;
char8='5.2';
char5=scan(char8,-1,'.');
/* char5 should be "2 ", not " " */
char6=scan(char8,-1,'.');
/* char6 is "2 " */
put char5= / char6=;
run;
In this example, the SCAN function incorrectly truncates the resulting
character expression "2bbbbb" from the left instead of the right and
assigns "bbbbb" to CHAR5.
Operating System and Release Information
| Product Family | Product | System | Reported Release | Fixed Release* |
| SAS System | Base SAS | Microsoft Windows 2000 Server | 8 TS M0 | 8.2 TS2M0 |
| Microsoft Windows 95/98 | 8 TS M0 | 8.2 TS2M0 |
| Microsoft Windows 2000 Professional | 8 TS M0 | 8.2 TS2M0 |
| Microsoft Windows 2000 Advanced Server | 8 TS M0 | 8.2 TS2M0 |
| Microsoft Windows 2000 Datacenter Server | 8 TS M0 | 8.2 TS2M0 |
| OpenVMS VAX | 8 TS M0 | 8.2 TS2M0 |
| Solaris | 8 TS M0 | 8.2 TS2M0 |
| OS/2 | 8 TS M0 | 8.2 TS2M0 |
| 64-bit Enabled Solaris | 8 TS M0 | 8.2 TS2M0 |
| IRIX | 8 TS M0 | 8.2 TS2M0 |
| z/OS | 8 TS M0 | 8.2 TS2M0 |
| ABI+ for Intel Architecture | 8 TS M0 | 8.2 TS2M0 |
| CMS | 8 TS M0 | 8.2 TS2M0 |
| HP-UX | 8 TS M0 | 8.2 TS2M0 |
| 64-bit Enabled HP-UX | 8 TS M0 | 8.2 TS2M0 |
| OpenVMS Alpha | 8 TS M0 | 8.2 TS2M0 |
| 64-bit Enabled AIX | 8 TS M0 | 8.2 TS2M0 |
| Microsoft Windows NT Workstation | 8 TS M0 | 8.2 TS2M0 |
| Tru64 UNIX | 8 TS M0 | 8.2 TS2M0 |
| AIX | 8 TS M0 | 8.2 TS2M0 |
*
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.
| Type: | Problem Note |
| Priority: | medium |
| Topic: | SAS Reference ==> Functions
|
| Date Modified: | 2001-03-06 15:52:23 |
| Date Created: | 2001-03-06 15:52:23 |