![]() ![]() This function needs a text string and an informat as its two arguments. With the INPUT function, you can convert a string that looks like a datetime (like 31DEC2020 23:59:59) into a SAS datetime variable. In SAS, a DateTime variable is the number of seconds between midnight on January 1, 1960, and a specific date, including the hour, minute, and second.įor example, a number such as 1925078399 represents December 31, 2020, at 23:59:59. Quit How to Convert a String into a Datetime?Ī text string can also be converted into a datetime, just as you can convert it into a date. proc sql Ĭreate table newdt as Select input(dt, mmddyy10.) as date format=weekdate. You must first convert the text date into a numeric SAS date using the input function, and then you can attach a format to the result to show how you want this SAS date to be printed. Newdates(i) = input(strip(olddates(i)),yymmdd10.) ![]() SAS Code to covert all character dates to SAS dates data out ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |