BookmarkSubscribeRSS Feed
Inp
Obsidian | Level 7 Inp
Obsidian | Level 7

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;

2 REPLIES 2
Shmuel
Garnet | Level 18

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.

Astounding
PROC Star
At the beginning of the DATA step, transfer the value of the macro variable to a DATA step variable:

Custname = symget('custname') ;

You will have no trouble working with a DATA step variable that contains an ampersand.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 628 views
  • 0 likes
  • 3 in conversation