- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 04-13-2010 05:48 AM
(3333 views)
HI There,
I'm new to SAS and I am having some problems with Dates, I need to do a comparative analysis on a relational Database, and in the past using other applications I could run the code alter session set nls_date_format='YYYYMMDD HH24:MI:SS' to allow the date to be formatted into the same format as the DB. I want to know how I can exectute that Oracle code using SAS.
Thanks.
Damon
I'm new to SAS and I am having some problems with Dates, I need to do a comparative analysis on a relational Database, and in the past using other applications I could run the code alter session set nls_date_format='YYYYMMDD HH24:MI:SS' to allow the date to be formatted into the same format as the DB. I want to know how I can exectute that Oracle code using SAS.
Thanks.
Damon
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I don't know a huge amount about Oracle in particular, but here are some basic pointers:
1. Databases like Oracle usually store dates and times in their date fields. SAS has separate concepts for date values and datetime values. The translation of Oracle datetime information into SAS datetime information usually works without any problems; however, getting Oracle datetime information into SAS date information requires a little more finese. There's a SAS function, DATEPART, that extracts a SAS date value from a datetime value. To use other SAS date functions like MONTH, YEAR, INTNX, etc. you often want date information and thus need to use that DATEPART function. If you don't mind doing your analysis with datetime information only, you don't need to worry as much.
2. In terms of the displaying values as YYYYMMDD HH24:MI:SS, I didn't see a default SAS format for displaying things that way, so you might need to create a user-defined format to do the job. This would be an example of a picture format. Take a look at some examples here: http://support.sas.com/kb/8/510.html. I believe the format you create would need to be applied separately to each column in reports you want values to display that way.
1. Databases like Oracle usually store dates and times in their date fields. SAS has separate concepts for date values and datetime values. The translation of Oracle datetime information into SAS datetime information usually works without any problems; however, getting Oracle datetime information into SAS date information requires a little more finese. There's a SAS function, DATEPART, that extracts a SAS date value from a datetime value. To use other SAS date functions like MONTH, YEAR, INTNX, etc. you often want date information and thus need to use that DATEPART function. If you don't mind doing your analysis with datetime information only, you don't need to worry as much.
2. In terms of the displaying values as YYYYMMDD HH24:MI:SS, I didn't see a default SAS format for displaying things that way, so you might need to create a user-defined format to do the job. This would be an example of a picture format. Take a look at some examples here: http://support.sas.com/kb/8/510.html. I believe the format you create would need to be applied separately to each column in reports you want values to display that way.