I'm trying to leverage the macro list function in SAS. Blocked_Email josh1@gmail.com josh3@yahoo.com HAVE data have;
input ID$ Date:mmddyy10. email_address: $40. acct: $25.;
format date mmddyy10.;
cards;
josh 1/1/2015 josh1@gmail.com 0004
josh 1/2/2015 josh2@yahoo.com 0005
josh 1/3/2015 josh3@yahoo.com 0006
mary 1/4/2015 mary123@aol.com 0007
mary 1/5/2015 mars@blah.com 0008
josh 1/6/2015 josh1@gmail.com 0009
josh 1/7/2015 josh2@yahoo.com 0010
josh 1/8/2015 josh3@yahoo.com 0011
mary 1/9/2015 mary123@aol.com 0012
mary 1/10/2015 mars@blah.com 0008
josh 1/11/2015 josh7@gmail.com 0005
; WANT id date email acct block josh 1/1/2015 josh1@gmail.com 0004 email josh 1/2/2015 josh2@yahoo.com 0005 notblocked josh 1/3/2015 josh3@yahoo.com 0006 email mary 1/4/2015 mary123@aol.com 0007 notblocked mary 1/5/2015 mars@blah.com 0008 notblocked josh 1/6/2015 josh1@gmail.com 0009 email josh 1/7/2015 josh2@yahoo.com 0010 notblocked josh 1/8/2015 josh3@yahoo.com 0011 email mary 1/9/2015 mary123@aol.com 0012 notblocked mary 1/10/2015 mars@blah.com 0008 notblocked josh 1/11/2015 josh7@gmail.com 0005 notblocked Right now my code is set up like this: I get this error 24 if upcase(Email_address) in (&BlockedEmail.) then Block='Email'; NOTE: Line generated by the macro variable "BLOCKEDEMAIL". 24 josh1@gmail.com ,josh2@yahoo.com ,josh3@yahoo.com _____ 22 76 24 ! ,josh7@gmail.com ,mars@blah.com ,mary123@aol.com ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant, a missing value, iterator, (. ERROR 76-322: Syntax error, statement will be ignored. 25 ;run; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.TEST may be incomplete. When this step was stopped there were 0 observations and 5 variables. WARNING: Data set WORK.TEST was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): /*Type2:Email*/
proc sql;
select distinct email_address into :BlockedEmail seperated by ',' notrim
from have
/*where BlockedTypeId=2 ;*/
;quit;
/*test*/
data Test;
set have;
Block='NotBlocked';
if upcase(Email_address) in (&BlockedEmail.) then Block='Email';
;run;
proc print data=test;run
... View more