You're right. It does not give me error this time when I restarted my EG. Very strange... Another question, is it possible that I put everything I wrote in the macro into a macro variable using %let = "", and just refer to the macro variable in the program? I tried: %let programlines = "Length owner $100.;
if ((ID='123' and &EVENT_DATE > '01APR2011'D) or (ID='456' and &EVENT_DATE > '05JUN2015'D) or (ID='789'))
then owner = 'JOHN';";
data orders;
length ID $3 cost 8. date1 8. date2 8.;
input ID cost date1 date2;
informat date1 mmddyy10. date2 mmddyy10.;
format date1 mmddyy10. date2 mmddyy10.;
datalines;
123 50 01/01/2020 02/01/2019
123 60 01/01/2011 03/05/2020
456 10 04/01/2019 01/03/2020
;
run;
%let EVENT_DATE=date1;
data owner;
set orders;
&programlines;
run; and of course, it does not work. It there a way to just use macro variables? I ask because in the end, all the dates and owner information will be stored in a dataset and I'd like to use something like this below to generate lines automatically: Proc sql;
select cat('if ID=', ID, 'and &eventdate>', datevariable, 'then owner="', ownervariable,'"; output;')
into: programlines
from datacontainvalues
;
quit; Thank you!!
... View more