Hello all,
Please help with the issue here. I have a list of IDs with their eligibility from and thru date.
For instance:
ID From Thru:
1 01/01/2012 01/01/2016
2 01/01/2015 12/31/2015
3 01/01/2014 07/01/2015
4 03/01/2012 09/01/2016
I would like my results to look like:
ID From Thru:
1 01/01/2015 12/31/2015
2 01/01/2015 12/31/2015
3 01/01/2015 07/01/2015
4 01/01/2015 12/31/2015
I used the if statement below and produce blank from and thru results that looks similar to:
ID From Thru:
1 . .
2 01/01/2015 12/31/2015
3 . 07/01/2015
4 . .
Can anyone help me with this issue? Thank you!!
if year(from) < ¤t_year. then from = &service_start_date_dateform.; if year(thru) > ¤t_year. then thru = &service_end_date_dateform.;
Please show the values of your macro variable ¤t_year, &service_start_date_dateform and &service_end_date_dateform. Also are your From and Thru variables SAS date values or Character values that look like dates?
Hello,
The macro is attaced here:
%let service_start_date_dateform = '01JAN2015';
%let service_end_date_dateform = '31DEC2015';
%let current_year = 2015;
Both the from and thru are in the date format with length=8
I have tried where statement or "if, else if"; both wont work.
Since you are referring to an error, it would be nice to see the log.
First, you need the dates to be stored as SAS dates.
If you are using macro variable as constants, I think the easiest is to have them formatted as DATE9, so you can use them in the assignment as:
"&service_start_date_dateform."D
Thank you very much! Adding "d" at the end of the macro works!!
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.