Hello,
How to select the people less than 5 days in the 'Birthdate' column? For example, 02/25/2020 <= 5 days.
Please always provide some sample data in the form of a SAS datastep.
Below should give you the idea.
data have;
input birthdate :date9.;
format birthdate date9.;
datalines;
01feb2000
20feb2001
27feb2002
05mar2003
;
data want;
set have;
_yearShift=intck('year',birthdate,today());
_birthdate=intnx('year',birthdate,_yearShift,'s');
format _birthdate date9.;
diff=today()-_birthdate;
/* if abs(diff)<=5 then output;*/
run;
proc print;
run;
Please always provide some sample data in the form of a SAS datastep.
Below should give you the idea.
data have;
input birthdate :date9.;
format birthdate date9.;
datalines;
01feb2000
20feb2001
27feb2002
05mar2003
;
data want;
set have;
_yearShift=intck('year',birthdate,today());
_birthdate=intnx('year',birthdate,_yearShift,'s');
format _birthdate date9.;
diff=today()-_birthdate;
/* if abs(diff)<=5 then output;*/
run;
proc print;
run;
Thank you.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.