Hi everyone,
I want to convert character mmddyy to numeric, here is my data :
Date
03/31/1980 (format$10)
06/30/1980
12/31/1980
I try my best to convert it to YYMMDDN8. , but it still doesn't work. I hope that somebody could help me to solve this problem.
Many thanks.
You have an MDY order in the date, so use the mmddyy10. informat.
As @Kurt_Bremser and @Astounding have pointed out, MMDDYY10. is the correct informat in this situation.
However, if in doubt, you can use the ANYDTDTEw. informat with a sufficiently long w, which is quite darn good at recognizing various character date patterns with a garden variety of delimiters used. For example, run this step for a demo:
data _null_ ;
retain dlmstr " ~!#$%^&*()-_=+[]{}\|;:.<>?" ;
length cdate $ 10 ;
do i = 1 to length (dlmstr) ;
cdate = catx (char (dlmstr, i), "09", "11", "2001") ;
ndate = input (cdate, anydtdte10.) ;
put cdate ndate yymmdd10. ;
end ;
run ;
Kind regards
Paul D.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.