Help using Base SAS procedures

SAS Dates

Accepted Solution Solved
Reply
N/A
Posts: 1
Accepted Solution

SAS Dates

error


Accepted Solutions
Solution
‎10-15-2014 08:09 PM
Trusted Advisor
Posts: 1,204

Re: SAS Dates

Something like this will produce the desired output. I am assuming the difference between dates as number of days.

data have;

input m d y date1 :mmddyy10.;

date2=mdy(m,d,y);

date_diff_day=intck('day',date2,date1);

format date1 date2 date9.;

datalines;

1     20     1985  01/30/1986

;

proc print data=have;

run;

View solution in original post


All Replies
Solution
‎10-15-2014 08:09 PM
Trusted Advisor
Posts: 1,204

Re: SAS Dates

Something like this will produce the desired output. I am assuming the difference between dates as number of days.

data have;

input m d y date1 :mmddyy10.;

date2=mdy(m,d,y);

date_diff_day=intck('day',date2,date1);

format date1 date2 date9.;

datalines;

1     20     1985  01/30/1986

;

proc print data=have;

run;

Contributor dkb
Contributor
Posts: 53

Re: SAS Dates

As the original question has been deleted, here is a copy from Google's cache.

------------------------------------------------------------------------------------------------------------------

I have a Data set that contains separate columns for day, month and year. I need to consolidated these into one single variable .

Example:

1     20     1985   (consolidated into a single SAS date)

Would I want to use the MDY Function? and what would this look like?

Once I've consolidated this date I need to find the difference from this new column and another date column that was originally a single columned date.

Thanks!

Jack

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 263 views
  • 0 likes
  • 3 in conversation