Hello, I have a qustion about the macro and CALL SYMPUT. Here is my codes: DATA test;
INPUT ID DATE MMDDYY8.;
DATALINES;
00001 05012017
00002 05032017
00003 05012017
00004 04282017
;
RUN;
%LET date_deb = DATE;
%LET date_fin = INTNX("month",&date_deb,+1,"sameday");
DATA _NULL_;
CALL SYMPUT("MOIS", SUBSTR(put(&date_deb,MMDDYY8.),7,2)!!SUBSTR(put(&date_deb,MMDDYY8.),1,2));
RUN;
DATA result;
SET test;
col1 = &date_deb;
col2 = &date_fin;
col3 = "Iwanttoprint&MOIS.it";
col4 = &MOIS;
col5 = SUBSTR(put(&date_deb,MMDDYY8.),7,2)!!SUBSTR(put(&date_deb,MMDDYY8.),1,2);
RUN; Results: 1 ID 1 DATE 20940 col1 20940 col2 20971 col3 Iwanttoprint . it col4 . col5 1705 2 2 20942 20942 20973 Iwanttoprint . it . 1705 3 3 20940 20940 20971 Iwanttoprint . it . 1705 4 4 20937 20937 20967 Iwanttoprint . it . 1704 My question is why col3 and col4 can not return to the value of 1705/1704? And could you please tell me how to fix it? In order to debug, I tried to replace the %LET date_deb = 20940, the codes are as following: %LET date_deb = 20940;
%LET date_fin = INTNX("month",&date_deb,+1,"sameday");
DATA _NULL_;
CALL SYMPUT("MOIS", SUBSTR(put(&date_deb,MMDDYY8.),7,2)!!SUBSTR(put(&date_deb,MMDDYY8.),1,2));
RUN;
DATA result2;
col1 = &date_deb;
col2 = &date_fin;
col3 = "Iwanttoprint&MOIS.it";
col4 = &MOIS;
col5 = SUBSTR(put(20940,MMDDYY8.),7,2)!!SUBSTR(put(20940,MMDDYY8.),1,2);
RUN; Result: ID 1 col1 20940 col2 20971 col3 Iwanttoprint1705it col4 1705 col5 1705 And it seems work in this way, but I don't understand why. Thank you in advance. VIVIAN
... View more