how to convert to sas date format ?

Reply
N/A
Posts: 0

how to convert to sas date format ?

1. I have date format YYYYMMDD
d1 = 20080416
How can I convert it to sas date format such as 16April2008 ?

2 .PROC IMPORT OUT= WORK.mydata
DATAFILE= "D:\SAS_data\RawData\test.xls"
DBMS=EXCEL2000 REPLACE;
SHEET="test$";
GETNAMES=YES;
RUN;
proc import above, Can I define format of variables in this part ?
thanks in advance.
N/A
Posts: 0

Re: how to convert to sas date format ?

rather than use PROC IMPORT, try using the SAS/Access to PC FIles facilities in the excel LIBNAME engine. That supports a dataset option SASDATEFMT=.

The Help and online Doc declares

~~~~~~~~~~~~~SAS Documentation extract ~~~~~~~~~~~~~~~~~~~~~~
SASDATEFMT=(data-source-date-column-1='SAS-date-format'<... data-source-date-column-n='SAS-date-format'>)


Syntax Description

data-source-date-column
specifies the name of a date column in a data source table.

SAS-date-format
specifies a SAS date format that has an equivalent (like-named) informat. For example, DATETIME21.2 is both a SAS format and a SAS informat, so it is a valid value for the SAS-date-format argument.
~~~~~~~~end of SAS Documentation extract ~~~~~~~~~~~~~~~~~~~~~~

Navigate the "Help and Documentation" menu item (a link into "compiled html help" ) through
SAS Products
SAS/Access
PC Files
Accessing PC Files
The LIBNAME Statement
SASDATEFMT=
On line at
http://support.sas.com/onlinedoc/913/getDoc/en/acpcref.hlp/a002261342.htm

Please can someone show the correct syntax for a link that opens such a page, but also having the tree pane on the left ?

PeterC
Ask a Question
Discussion stats
  • 1 reply
  • 301 views
  • 0 likes
  • 1 in conversation