Sep 11, 2013 #1 KH75 Programmer Jun 1, 2010 42 CA Hi I have text columns date1 = 20135 (2013 is year and 5 is month) date2 = 20109 (2010 is year and 9 is month) I want to convert text in to date to get the number of months I am using proc sql any idea how to do this in proc sql? thanks
Hi I have text columns date1 = 20135 (2013 is year and 5 is month) date2 = 20109 (2010 is year and 9 is month) I want to convert text in to date to get the number of months I am using proc sql any idea how to do this in proc sql? thanks
Oct 2, 2013 #2 klaz2002 Programmer Nov 6, 2002 559 US Well you could use the informat YYMMn. This will set the date value to the first of the month in question. So in your case May 1, 2013 Here is an example that presumes that your variable with the '20135' value is named mydate. proc sql; create table test as select *, input(mydate, yymmn6.) as mynewdate from mydataset ; quit; I hope that this helps you. Klaz Upvote 0 Downvote
Well you could use the informat YYMMn. This will set the date value to the first of the month in question. So in your case May 1, 2013 Here is an example that presumes that your variable with the '20135' value is named mydate. proc sql; create table test as select *, input(mydate, yymmn6.) as mynewdate from mydataset ; quit; I hope that this helps you. Klaz