Hello,
Here is my coding.
I want to mask the customer name ( In my case Business name) which has '&' in it. My coding is working as I expect, but I am getting the warning message , but don't want. Can any expertise help me . I am using SAS 9.4
filename EMALRPT 'C:\TMP\TESTEMAIL.txt';
%MACRO EMAILRPT(RE,TOADD,FROMADD,CCADD,CMTH1,CUSTNAME);
DATA _NULL_;
FILE EMALRPT MOD;
PUT @1 'OPTIONS S=80 ;';
PUT @1 'FILENAME EFILE EMAIL ';
PUT @4 ' TO = ( ';
PUT @3 "'&TOADD'";
PUT @9 ' )';
PUT @3 " FROM= &FROMADD ";
PUT @3 ' CC = ( ';
PUT @3 "&CCADD ";
PUT @10 ')';
SUBJECT = CAT('SUBJECT=%NRSTR("','PRE_NEED SERVICE REPORT FOR : ',
"%NRSTR(&CUSTNAME). &CMTH1",'")');
PUT @3 SUBJECT ;
/*
SUBJECT = CAT('SUBJECT=%NRSTR(','PRE_NEED SERVICE REPORT FOR : ',"&CUSTNAME
PUT @3 SUBJECT;
*/
PUT #3 'ATTACH = ( ';
PUT @3 "'VA959.VQ3.PDF(#&RE)' ";
PUT @3 "CT = 'APPLICATION/PDF'";
PUT @3 "EXT = 'pdf' ";
NAME = CAT('NAME=%NRSTR("',"&CUSTNAME. &CMTH1",'")');
PUT @3 NAME;
PUT @3 ' ';
PUT @10 ');' ;
PUT @3 'RUN;';
PUT @1 'DATA _NULL_ ;';
PUT @1 'FILE EFILE ;';
PUT @1 " PUT 'Dear Customer, ';";
PUT @1 'RUN;';
RUN;
%MEND EMAILRPT;
%let ASATDATE = FEB2019;
DATA _NULL_;
VAL=1;
TOADD='MY@GMAIL.COM';
FROMADD="'FROMMYEMAIL@GMAIL.COM'";
CCADD="'MYCCEMAIL@GMAIL.COM'";
CMTH1="&ASATDATE";
CUSTNM = 'COMPANY1 &COMPNAY2 * # , / TEST DDD';
CALL EXECUTE (CATS('%EMAILRPT(',VAL,',',TOADD,',',FROMADD,
',',CCADD,',',CMTH1,',','%NRSTR(',CUSTNM,'))'));
STOP;
RUN;
What & do you want to mask. There are several in your code.
I suggest to change FILE EMALRPT MOD; with FILE PRINT; for a test.
Post log and result and point at what yo want to get instead.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.