i am searching for code where it should flag current date & time as 1 and previous all records as 0
e.g. st_date= 13/11/2017 15:30:33 =1
where st_date=13/11/2017 14:30:33 =0;
As i am appending the data to new data set so if it runs multiple times the flag should tag the latest run as 1 rest as 0
Thanks
Are you working with a datetime variable or a date and a time variable separately? 🙂
Post some example data, that makes it a lot easier to give a usable answer ..
So if your appending data, and presumably this will continue into the future, what happens to new data nest time? Or does this process affect all the data new and old? The logic is simple either way but which you choose depends on your situation:
data want; set old new; check=ifn(your_date < today(),0,1); run;
Or:
data new; set new; check=ifn(your_date < today(),0,1); run; data want; set old new; run;
Assumes real datetime.
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.