2016-06-15 7 views
0

에 전달하므로 요소가 따옴표로 묶인 전자 메일 문자열입니다. 단일 데이터 요소는 다음과 같을 수 있습니다. "[email protected]" "[email protected]" "[email protected]" "[email protected]"sas는 따옴표로 묶은 문자열을 매크로

다음과 같은 매크로 명령과 데이터가 있습니다. 단계 :

%macro Emailer(RCP=); 
/* body of the e-mail*/ 
data _null_; 
    file tmp; 
    put "Hello, World! <BR>"; 
run; 

/*to-from*/ 
Filename tmp Email 
Subject="Hello World Test" 
To= (&RCP) 
CT= "text/html"; 
%mend Emailer; 

data _null_; 
    set EmailLists; 
    call execute('%Emailer(RCP='||ListOfEmails||')'); 
run; 

하지만 계속 "ERROR : 매크로 매개 변수에 구문 오류가 있습니다."

내 데이터 요소에 공백이나 따옴표가 있거나 둘 모두가 있기 때문입니까?

미리 감사드립니다.

+0

매크로가 거꾸로 보입니다. FILENAME 문으로 정의하기 전에 TMP 파일에 쓰고 있습니다. – Tom

+0

FILENAME 문의 바로 뒤에 데이터 단계를 호출 할 수 있습니까? – Prototank

+0

FILENAME 문에 정의 된 fileref를 정의한 후 언제든지 참조 할 수 있습니다. EMAILLISTS 입력 데이터 세트에 무엇이 포함되어 있는지 명확하게 설명해야합니다. 여러 개의 레코드 또는 단일 레코드가 있습니까? – Tom

답변

1

테스트하는 한 가지 방법은 데이터 단계가 아닌 매개 변수를 직접 전달하는 것입니다. 처음에 나는 명령문의 순서를 재정렬 할 것이라고 주석가들이 지적했다.

%macro Emailer(RCP=); 
    filename myEmail Email; 
    data _null_; 
    file myEmail Subject = "Hello World Test" 
       To = (&RCP) 
       CT = "text/html"; 
    put "Hello, World! <BR>"; 
    run; 
    filename myEmail clear; 
%mend Emailer; 

그리고 (Outlook이 그래서 난이 중 하나를 테스트 할 수 없습니다 내 32 비트 내 64 비트 SAS 작업을 할 수 없습니다) 그 작업 중 하나를 시도해보십시오 : 후

%Emailer(RCP="[email protected]" "[email protected]" "[email protected]") 
%Emailer(RCP="[email protected] [email protected] [email protected]") 
%Emailer([email protected] [email protected] [email protected]) 
%Emailer([email protected] ; [email protected] ; [email protected]) 

을 어떤 형태로 작동하는지 알아 내고, 나머지는 쉬워야합니다.

+0

좋은 답변입니다! 올바른 형식은 다음과 같습니다. % Emailer (RCP = "[email protected]" "[email protected]" "[email protected]") 공백없이 . – Prototank

+0

흥미 롭습니다 ... 호기심에 의해서, 당신은 이것과 비슷한 것을 시도해 보셨습니까? '% Emailer (RCP = "[email protected]; [email protected]; [email protected]")? –

관련 문제