If the SAS Enhanced Editor window contains SAS® software code with nested macros, then incorrect syntax coloring might occur for some of the statements that are embedded in the macro. These statements include procedures or data steps. Similar statements in other parts of the embedded macro might also be affected, depending on the position of the statements in the macro.
In addition, after the final %MEND statement (which indicates the end of the nested macro), the next step boundary is not re-established for the subsequent code. Hence, after the nested macro code, the step boundary line is missing. Also, the +/- to expand or collapse the PROC or data step is missing. Therefore, if you collapse the embedded macro, all the code subsequent to the embedded macro is also collapsed, along with the embedded macro.
Currently, the standard SAS statements and procedures within a single macro do not have syntax checking, highlighting, or step boundaries, which is the expected behavior. Only the macro statements themselves are color coded, which indicates syntax checking.
Note: The step boundaries are indicated with the + or - beside the PROC or DATA statements, and solid horizontal lines are displayed between the code to designate a step boundary. You can select the + or - to expand or collapse the code in that particular step only.
To demonstrate the nested macro problem, paste the following code into the SAS Enhanced Editor. Note that the syntax highlighting is inconsistent in the macro definition. Also, after the macro definition, there are no step boundary lines or the +/-. However, note that they appear for the first two steps prior to the macro.
DATA test;
DO i=1 TO 100;
key=i*RANUNI(34);
OUTPUT;
END;
RUN;
PROC SORT DATA=test;
BY i;
RUN;
%MACRO m1(number);
DATA test&number.;
SET test;
RUN;
%MACRO m2(number);
PROC SORT DATA=test&number.;
BY key;
RUN;
%MEND m2;
%m2(&number.);
DATA test&number.;
SET test&number;
WHERE counter>50;
RUN;
%MEND m1;
%m1(1);
%m1(2);
DATA new;
SET var1 var2;
RUN;
PROC FREQ DATA=new;
TABLES key;
RUN;
There is no circumvention for this problem.
A fix for this issue is planned for a future software release.
However, in order to check the syntax within a single macro, comment out all of the macro statements. Note that the color coding is applied, showing possible syntax problems. Step boundaries are also present.
Alternatively, open the macro code in the Program Editor window, instead of the Enhanced Editor window. This causes the color coding to appear, but not step boundaries.
Operating System and Release Information
SAS System | Base SAS | Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft® Windows® for x64 | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |
Windows Vista | 9.1 TS1M3 SP4 | |
*
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.