—•Today is •—

Having a column with a character value of 10/19/2006, 05/17/2006, etc, and you need to use this particular column in calculations, the following is a method that can be used in SAS Enterprise Guide to convert the column from character into a SAS date. In which the SAS date can then be used in computations.

Use File->Open->From SAS Server/Binder to open the data with the character date column which you want to convert to a SAS date column. If the data is set to read only, click Data on the main toolbar and unselect Read-only to unprotect the data so that it may be edited. Click Yes when you are prompted about switching the data to update mode.

If you do not have write access to this data, right-click on the data icon and choose Export to save the data to a location on the SAS server where you have write access. Then open the data from the new location and unprotect it as instructed above.

Continue with the following step:

  • Right-click on the column to be converted and select Properties.
  • Change the type to Numeric and click Yes in the warning prompt regarding precision.
  • Change the Group to Date.
  • Click Informats; the selected value under Categories should be Date. Change the informat to ANYDTDTEw.
  • Under Attributes, assign an overall width of 10.
  • Click Formats; the selected value under Categories should be Date. Change the format to MMDDYYw.d.
  • Under Attributes, assign an overall width of 10.
  • Click OK. If the conversion results are correct in the Preview Results window, click Commit changes.

Note: This technique can also be used to convert between other column and data types.

Print Document

Copyright © 2002-2006 www.nycinformatics®.com All Rights Reserved
Last edited on: May 28, 2006
SAS product or service names are registered trademarks of SAS Institute, Inc. in the USA and other countries.
® indicates USA registration.