Hi all,
I am using an existing macro code from another program but I am getting error. I am not sure what is wrong with the macro. Could you please look at the macro and suggest how to correct it?
/*Create date macros*/
%let REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,0,begin));
%let PQ_REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,-3,begin));
%let yyyymm = %sysfunc(intnx(month,"&REP_DATE_START_END."d,0,begin),yymmn6.);
%let yyyymm_Camel = %sysfunc(intnx(month,"&REP_DATE_START_END."d,-1,begin),yymmn6.);
Error message:
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='Set up';
4 %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5 %LET _CLIENTPROJECTPATH='';
6 %LET _CLIENTPROJECTPATHHOST='';
7 %LET _CLIENTPROJECTNAME='';
8 %LET _SASPROGRAMFILE='';
9 %LET _SASPROGRAMFILEHOST='';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=SVG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 %macro HTML5AccessibleGraphSupported;
15 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) >= 0 %then ACCESSIBLE_GRAPH;
16 %mend;
17 FILENAME EGHTML TEMP;
18 ODS HTML5(ID=EGHTML) FILE=EGHTML
19 OPTIONS(BITMAP_MODE='INLINE')
20 %HTML5AccessibleGraphSupported
21 ENCODING='utf-8'
22 STYLE=HTMLBlue
23 NOGTITLE
24 NOGFOOTNOTE
25 GPATH=&sasworklocation
26 ;
NOTE: Writing HTML5(EGHTML) Body file: EGHTML
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.
ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC
or %QSYSFUNC function reference is terminated.
27
28 /*Create date macros*/
29 %let REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,0,begin));
30 %let PQ_REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,-3,begin));
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.
ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC
or %QSYSFUNC function reference is terminated.
31 %let yyyymm = %sysfunc(intnx(month,"&REP_DATE_START_END."d,0,begin),yymmn6.);
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.
ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC
or %QSYSFUNC function reference is terminated.
32 %let yyyymm_Camel = %sysfunc(intnx(month,"&REP_DATE_START_END."d,-1,begin),yymmn6.);
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.
ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC
or %QSYSFUNC function reference is terminated.
33
34 %LET _CLIENTTASKLABEL=;
35 %LET _CLIENTPROCESSFLOWNAME=;
36 %LET _CLIENTPROJECTPATH=;
37 %LET _CLIENTPROJECTPATHHOST=;
2 The SAS System 15:08 Tuesday, February 20, 2024
38 %LET _CLIENTPROJECTNAME=;
39 %LET _SASPROGRAMFILE=;
40 %LET _SASPROGRAMFILEHOST=;
41
42 ;*';*";*/;quit;run;
43 ODS _ALL_ CLOSE;
44
45
46 QUIT; RUN;
28 /*Create date macros*/ 29 %let REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,0,begin)); 30 %let PQ_REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,-3,begin)); WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
You have not assigned a value to REP_DATE_START_END and so you cannot use it in INTNX.
Perhaps you mean to use another macro variable with a similar name that does have a value?
Starting at the top,
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
WARNING: Apparent symbolic reference REP_DATE_START_END not resolved.
No where in the code is that macro variable defined, so it comes from another part of the process. Back up and check that process and ensure the macro variable is created correctly.
@Sandeep77 wrote:
Hi all,
I am using an existing macro code from another program but I am getting error. I am not sure what is wrong with the macro. Could you please look at the macro and suggest how to correct it?
/*Create date macros*/ %let REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,0,begin)); %let PQ_REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,-3,begin)); %let yyyymm = %sysfunc(intnx(month,"&REP_DATE_START_END."d,0,begin),yymmn6.); %let yyyymm_Camel = %sysfunc(intnx(month,"&REP_DATE_START_END."d,-1,begin),yymmn6.); Error message: 1 ;*';*";*/;quit;run; 2 OPTIONS PAGENO=MIN; 3 %LET _CLIENTTASKLABEL='Set up'; 4 %LET _CLIENTPROCESSFLOWNAME='Process Flow'; 5 %LET _CLIENTPROJECTPATH=''; 6 %LET _CLIENTPROJECTPATHHOST=''; 7 %LET _CLIENTPROJECTNAME=''; 8 %LET _SASPROGRAMFILE=''; 9 %LET _SASPROGRAMFILEHOST=''; 10 11 ODS _ALL_ CLOSE; 12 OPTIONS DEV=SVG; 13 GOPTIONS XPIXELS=0 YPIXELS=0; 14 %macro HTML5AccessibleGraphSupported; 15 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) >= 0 %then ACCESSIBLE_GRAPH; 16 %mend; 17 FILENAME EGHTML TEMP; 18 ODS HTML5(ID=EGHTML) FILE=EGHTML 19 OPTIONS(BITMAP_MODE='INLINE') 20 %HTML5AccessibleGraphSupported 21 ENCODING='utf-8' 22 STYLE=HTMLBlue 23 NOGTITLE 24 NOGFOOTNOTE 25 GPATH=&sasworklocation 26 ; NOTE: Writing HTML5(EGHTML) Body file: EGHTML WARNING: Apparent symbolic reference REP_DATE_START_END not resolved. WARNING: Apparent symbolic reference REP_DATE_START_END not resolved. ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number. ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated. 27 28 /*Create date macros*/ 29 %let REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,0,begin)); 30 %let PQ_REP_DATE_START = %sysfunc(intnx(month,"&REP_DATE_START_END."d,-3,begin)); WARNING: Apparent symbolic reference REP_DATE_START_END not resolved. WARNING: Apparent symbolic reference REP_DATE_START_END not resolved. ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number. ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated. 31 %let yyyymm = %sysfunc(intnx(month,"&REP_DATE_START_END."d,0,begin),yymmn6.); WARNING: Apparent symbolic reference REP_DATE_START_END not resolved. WARNING: Apparent symbolic reference REP_DATE_START_END not resolved. ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number. ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated. 32 %let yyyymm_Camel = %sysfunc(intnx(month,"&REP_DATE_START_END."d,-1,begin),yymmn6.); WARNING: Apparent symbolic reference REP_DATE_START_END not resolved. WARNING: Apparent symbolic reference REP_DATE_START_END not resolved. ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number. ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated. 33 34 %LET _CLIENTTASKLABEL=; 35 %LET _CLIENTPROCESSFLOWNAME=; 36 %LET _CLIENTPROJECTPATH=; 37 %LET _CLIENTPROJECTPATHHOST=; 2 The SAS System 15:08 Tuesday, February 20, 2024 38 %LET _CLIENTPROJECTNAME=; 39 %LET _SASPROGRAMFILE=; 40 %LET _SASPROGRAMFILEHOST=; 41 42 ;*';*";*/;quit;run; 43 ODS _ALL_ CLOSE; 44 45 46 QUIT; RUN;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.