Solved

Converting data from a text field to a formatted field date - SAS

Posted on 2011-09-04
1
413 Views
Last Modified: 2013-11-16
i am reading data in from a text field where  it is entered in different formats.

     i.e      1-1.11
               1-01-2011
               1/1/2011

I need the output to  be in format  mm/dd/yyyy  01/01/2011

Is there a way to do this with the inconsistencies in data input?
             
0
Comment
Question by:morinia
[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
1 Comment
 
LVL 14

Accepted Solution

by:
Aloysius Low earned 500 total points
ID: 36481983
you could try the anydtdte informat:

data [output];
set [input];
converted_date=input([string date text column], ANYDTDTE.);
format converted_date mmddyy10.;
run;

the above display the value in mmddyy format, but the actual value stored will be a sas date

if you want the dates as a text value, then change the format statement to something like converted_date_mdy = put(converted_date, mmddyy10.);
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

751 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