## How to do a minus -1 from date

Solved
Regular Contributor
Posts: 240

# How to do a minus -1 from date

hi I have a table that shows 8 days worth of data which includes today's date  I need to exclude today's date ...

the he data looks like this

03/13/15.    Tid

03/14/15.     Tid

03/15/15.      Tid

03/16/15.      Tid

03/17/15.      Tid

03/18/15.       Tid

03/19/15.       Tid

3/20/15.         Tid

I Need to remove current date since its a partial data and keep first 7 days thanks

Accepted Solutions
Solution
‎03-21-2015 02:31 AM
Super User
Posts: 10,770

## Re: How to do a minus -1 from date

if date = today() then delete;

All Replies
Solution
‎03-21-2015 02:31 AM
Super User
Posts: 10,770

## Re: How to do a minus -1 from date

if date = today() then delete;

Posts: 4,736

## Re: How to do a minus -1 from date

Please try and provide ready made sample data (so a data step creating the table) so we don't have to do this. It's also always good to post some code even if unfinished as this will help us to better understand where you're coming from.

data have;

attrib

have_date length=8 informat=mmddyy10. format=date9.

other_var length=\$8

;

infile datalines dlm='.' truncover;

input have_date other_var;

datalines;

03/11/15. Tid

03/12/15. Tid

03/13/15. Tid

03/14/15. Tid

03/15/15. Tid

03/16/15. Tid

03/17/15. Tid

03/18/15. Tid

03/19/15. Tid

03/20/15. Tid

;

run;

data want;

set have;

/*  if 1<= (today() - have_date) <=7;*/

if 1<= ('20Mar2015'd - have_date) <=7;

run;

🔒 This topic is solved and locked.