06-17-2014 03:19 AM
I am relatively new at this and always find this tricky i have fields that are like 1/7/2011 12/11/2013 etc, and they are text, how do i turn these into proper sas dates.
Thanking in advance,
06-17-2014 07:54 PM
These are variables within a dataset, I've tried this:
but that dont seem to work, any other suggestions will be greatly apreciated.
06-17-2014 06:58 AM
Per slchen you would use the input function to convert text strings into numeric variables (which are what date/time variables are in SAS). The input requires you to specify the format of the data, length. So in your example your date value is 10 characters, mm/dd/yyyy, spaces are interpreted as 0. So the format to read this in would be mmddyy10. If you have only a two digit year then: mm/dd/yy, so the format is mmddyy8. The input reads in the text string and converts it to numeric SAS date which can have a format applied to it to show the date representation - otherwise you will just see a number. The reverse of course is put which takes a numeric and puts it into a character string.
Need further help from the community? Please ask a new question.