Usage Note 50823: Consider using the IN_OUT argument when defining DS2 methods with character arguments
DS2's default parameter passing semantics are pass-by-value. This means that a copy of the parameter is made and the copy is passed to the method, not the original parameter. Any changes to the parameter by the method are made to the copy and not to the original parameter, ensuring that the value of the original parameter is maintained for the caller of the method.
Given the potential size of character variables, the cost of making the copy, in terms of both memory and time, can be great. To avoid this cost, consider using the IN_OUT argument, which causes the parameter to be passed-by-reference. This means that the location or address of the parameter is passed to the method, and a second copy of the parameter is not made. Changes made to the value of the parameter by the method, either intentional or unintentional, are reflected in any reference to the parameter by the caller after the method returns.
For information about related restrictions, requirements, and tips, see the
Method statement in the SAS® 9.4 DS2 Language Reference.
This syntax shows the two types of parameter passing:
/* pass-by-value */
method copy_made(char(256) x);
...
end;
/* pass-by-reference */
method no_copy(in_out char x);
...
end;
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.4 TS1M0 | |
Z64 | 9.4 TS1M0 | |
Microsoft® Windows® for x64 | 9.4 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.4 TS1M0 | |
Microsoft Windows 8 Enterprise 32-bit | 9.4 TS1M0 | |
Microsoft Windows 8 Enterprise x64 | 9.4 TS1M0 | |
Microsoft Windows 8 Pro 32-bit | 9.4 TS1M0 | |
Microsoft Windows 8 Pro x64 | 9.4 TS1M0 | |
Microsoft Windows Server 2008 R2 | 9.4 TS1M0 | |
Microsoft Windows Server 2008 for x64 | 9.4 TS1M0 | |
Microsoft Windows Server 2012 Datacenter | 9.4 TS1M0 | |
Microsoft Windows Server 2012 Std | 9.4 TS1M0 | |
Windows 7 Enterprise x64 | 9.4 TS1M0 | |
Windows 7 Professional x64 | 9.4 TS1M0 | |
64-bit Enabled AIX | 9.4 TS1M0 | |
64-bit Enabled HP-UX | 9.4 TS1M0 | |
64-bit Enabled Solaris | 9.4 TS1M0 | |
HP-UX IPF | 9.4 TS1M0 | |
Linux for x64 | 9.4 TS1M0 | |
Solaris for x64 | 9.4 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.
Using the IN_OUT argument for passing character parameters to methods in DS2 might be more efficient.
Date Modified: | 2013-09-17 17:05:33 |
Date Created: | 2013-08-21 15:06:18 |