BookmarkSubscribeRSS Feed
RRzio11
Calcite | Level 5

Hello,

 

I am needing to convert the "DATEINT" variable into a numeric, date format (mmddyy10.) however I am having trouble doing so. 

 

DATA WAVE5_8LD;
SET WAVE5_8L;
NDATEINT= INPUT(DATEINT,DDMMYY10.);
FORMAT DATEINT MMDDYY10.;
RUN;

 

I want to be able to format "DATEINT"  to match how variable "dod" is so that I can perform an analysis on them. This is from a pre-existing dataset. 

 

 

Screen Shot 2020-08-11 at 12.09.25 AM.pngScreen Shot 2020-08-11 at 12.09.39 AM.pngScreen Shot 2020-08-11 at 12.09.32 AM.png

6 REPLIES 6
andreas_lds
Jade | Level 19

It seems that you are using the wrong informat, ddmmyy requires the month to be a number from 1 to 12, not the abbreviated month name. Unfortunately you have not posted the data in usable form, so i won't provide code. Maybe reading those dates is possible with date9-informat after applying compress-function to dateint removing the hyphens.

RRzio11
Calcite | Level 5

attached is my dataset

Kurt_Bremser
Super User

Read like this:

data test;
infile '/folders/myfolders/WAVE5_8L.csv' dlm=',' dsd firstobs=2;
input
  q_no $
  isdead
  agedie
  dod :mmddyy10.
  YSMOKE
  wave
  DATEINT :date11.
  UM
  UG
  TOTMMSE
  TOTADL
  sfrailcatb
  sex
  nfrac
  marstat
  ll
  lcancr
  khyper
  jstrok
  icardi
  cesdtot
  bmi
  age
  mdiab
;
format dod dateint yymmdd10.;
run;
RRzio11
Calcite | Level 5
Thank you so much! could you help me calculate the difference between "Dateint" and "DOD" in days?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

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
  • 6 replies
  • 1136 views
  • 0 likes
  • 3 in conversation