You forgot the second hiredate
Data a;
Set Sonu. Emp;
If hiredate >= '20feb1981'd and hiredate <= '03dec1981'd;
Run;
But you can also use the YEAR function:
Data a;
Set Sonu. Emp;
If year(hiredate) = 1981;
Run;
and for ranges you can use something like this as well:
Data a;
Set Sonu. Emp;
If '20feb1981'd <= hiredate <= '03dec1981'd;
Run;
@sogauli6 wrote:
To get a date range with ‘if’ statement . I only need to select 1981 year date there is 6 date with that year.
Data a;
Set Sonu. Emp;
If hiredate >= ‘20feb1981’d and <= ‘03dec1981’d;
Run;
EDIT: you also have curly quotes not straight ones (you copied and pasted from somewhere?). Those will likely cause an issue with your code and I've updated this post to fix those.