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?

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 2121 views
  • 0 likes
  • 3 in conversation