Link to home
Start Free TrialLog in
Avatar of WTH_LOL
WTH_LOL

asked on

SAS date conversion

When I import an Excel file into SAS it gives me this date fromat:
12OCT2008, (DATE9 format and informt).

I want to convert that date as it exist now in the file (i.e. I don't want to convert it during the
import process) to TEXT so that I looks and feels like:
2008-10-12.

I need the date to be TEXT because I also have missing dates in the file
and I need to lable the missing values "NS".  

Pleaase advise.   Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Aloysius Low
Aloysius Low
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi

SAS will often try to "guess" whether a field is text or numeric based on the first few rows.  If the field looks like a date, then it assumes the whole table is dates.

If you want SAS to guess from all the rows (not just the first few) then SAS recommends that you adjust the registry (make a back up of the registry just in case).  If you have "NS" in the missing fields, in excel, then SAS will import the date field as text:


Start ->  Run

Enter Regedt32 select OK.

Open this key in the Registry Editor window:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Access Connectivity Engine\Engines\Excel

Double-click TypeGuessRows.

Select Decimal, enter 0 in the Value field, and select OK.

Exit from the Registry Editor window.