Hello
I am trying to create a parameter of a date value and use it to take all rows with date higher than 01Apr2017.
Can anyone please explain why it is not working and what is the correct code?
Thanks a lot
data aaa;
length LOC_ID $8 Date Demand 8;
LOC_ID = "C1";
demand = 0;
do Date = '01JAN2017'd to '30JUN2017'd;
output;
end;
run;
Also, your second data step is redundant. Simple use the FORMAT Statement in your first data step.
sorry.Here is the code.Why is it no working?
data aaa;
length LOC_ID $8 Date Demand 8;
LOC_ID = "C1";
demand = 0;
do Date = '01JAN2017'd to '30JUN2017'd;
output;
end;
run;
data bbb;
set aaa;
format Date date9.;
run;
%let monParam='01Apr2017'd;
Data Want;
SET bbb;
IF Date>&monParam.;
Run;
I get no errors from running the code.
Please post your log and what yoy consider "not working".
Sorry.You are right. I run it again and it is working.Thank you anyway
Also, your second data step is redundant. Simple use the FORMAT Statement in your first data step.
Please define "not working". After tidying up your code and dropping the unnecessary datastep the code works perfectly:
data aaa; length loc_id $8 date demand 8; loc_id="C1"; demand=0; do date='01JAN2017'd to '30JUN2017'd; output; end; format date date9.; run; %let monparam='01Apr2017'd; data want; set aaa; if date > &monParam.; run;
⏰
Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.
Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.