BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JackFerral
Calcite | Level 5

error

1 ACCEPTED SOLUTION

Accepted Solutions
stat_sas
Ammonite | Level 13

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

2 REPLIES 2
stat_sas
Ammonite | Level 13

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;

dkb
Quartz | Level 8 dkb
Quartz | Level 8

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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