[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SAS date conversion

Posted on 2011-03-03
2
Medium Priority
?
796 Views
Last Modified: 2013-11-16
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.
0
Comment
Question by:WTH_LOL
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
Aloysius Low earned 2000 total points
ID: 35032908
what you can do is to use Excel to prepare the data first, since it's your requirement that you wanted as it is now in the file not on import.

the excel formula you could use to convert a date field into the character string format that you required is =TEXT([cell],"yyyy-mm-dd")

in this case, import will recognise the new field as a character and import as such.
0
 
LVL 11

Expert Comment

by:theartfuldazzler
ID: 35034047
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.
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question