data DSM2;
set DSM1;
Orig = &pbd_date-LN_FST_DUE_DT;
DPD = &pbd_date-LN_NXT_PMT_DUE_DT;
if DPD >=90 and DPD <=720;
if Orig >365;
run;
notice the
if DPD >=90 and DPD <=720;
I believe there is another way to reflect in between? Something like 90<=DPD<=720
proc sql;
create table DSM2 as
select &pbd_date-LN_FST_DUE_DT as Orig
,&pbd_date-LN_NXT_PMT_DUE_DT as DPD
from DSM1
where (&pbd_date-LN_NXT_PMT_DUE_DT) between 90 and 720 AND
(&pbd_date-LN_FST_DUE_DT) > 365;
quit;
run;
There ya go
Exactly, have you tried it:
if 90<=DPD<=720;
Haikuo
Except that won't work in macro code in certain circumstances, so be careful where you use it.
I actually had this exact issue Reeze, and that is why I moved to running the proc sql version that I originally suggested. I have not run into the proc sql having any issues in any of the macro coding that I have used thus far.
IF anyone thinks it would cause problems please say so!
Brandon
Thanks, Fareeza, good to know. It would be helpful if someone could elaborate more details on the errors when using this in Macro.
Haikuo
FWIW, Finally I bumped into something from SAS-L regarding this matter:
Quote from one of Lassen's recent posts:
"
as the macro language interpreter evaluates it like this
1<0<2 -> (1<0)<2 -> 0<2 -> 1
"
Which means macro language evaluates expressions in a segmental pattern, not as a whole. It is not necessarily causing error message, it just interprets it differently, therefore leads to unexpected results. So as long as you know know how exactly it works, you can still use it in Macro language.
Haikuo
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: