This is most likely a simple question, but I have not yet been able to figure it out.
I need to retrieve some data from a SAS dataset where the DATE falls within a 6 month range (ex. 01JAN2017 to 30JUN2017) I tried running the following code, but it results in an error. Any thoughts? I'm sure this is something simple...
%let start1 = %Sysfunc( InputN( 01JAN2017 , Date9. ) ) ;
%let start2 = %sysfunc(putN(&start1, date9));
%put start1 &start1 start2 &start2;
%let end1 = %sysfunc(inputn(30JUN2017,Date9.));
%let end2 = %sysfunc(putN(&end1, date9));
%put end1 &end1 end2 &end2;
proc print data=ext.account_detail (obs = 10);
where manufacturer = 'FORD' or product_segment = 'CHRYSLER'
and manufacturer_date between &start2 and &end2;
run;
The result is the following error: NOTE: Line generated by the macro variable "START2".
26 01JAN2017
_______
22
76
ERROR: Syntax error while parsing WHERE clause.
ERROR 22-322: Syntax error, expecting one of the following: !!, *, **, +, -, /, AND, ||.
ERROR 76-322: Syntax error, statement will be ignored.