monicajane84
Programmer
Ok, my ultimate goal is to perform a simple calculation on two dates to get the number of days between the two. This is part of a large program that needs to be automated for a user with minimal SAS knowledge. So they won't be able to troubleshoot date conversion/calculation issues easily.
Problem 1 - Each time the data (in Excel) are imported into SAS, depending on how complete the data is for both date fields, they are importing as either numerical or character.
I attempted to correct for this by using the SQL DICTIONARY table COLUMNS to identify the character dates (if they've been imported as such) and a macro to convert them to a SAS date using:
date_num = input(date_char, mmddyy10.);
The whole thing works and the calculations process correctly. However...
Problem 2 - the new format for date_num still isn't numerical, it's a character SAS date. Weird? This would be fine, as long as the calculations worked out, if I didn't need to use these dates in a PROC PRINT later on. They print as SAS dates (i.e. 17564) and can't be date formatted because they're still character vars!
Any ideas would be much appreciated! Thanks in advance
Problem 1 - Each time the data (in Excel) are imported into SAS, depending on how complete the data is for both date fields, they are importing as either numerical or character.
I attempted to correct for this by using the SQL DICTIONARY table COLUMNS to identify the character dates (if they've been imported as such) and a macro to convert them to a SAS date using:
date_num = input(date_char, mmddyy10.);
The whole thing works and the calculations process correctly. However...
Problem 2 - the new format for date_num still isn't numerical, it's a character SAS date. Weird? This would be fine, as long as the calculations worked out, if I didn't need to use these dates in a PROC PRINT later on. They print as SAS dates (i.e. 17564) and can't be date formatted because they're still character vars!
Any ideas would be much appreciated! Thanks in advance