Solved

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

Posted on 2011-09-04
1
407 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
1 Comment
 
LVL 14

Accepted Solution

by:
Aloysius Low earned 500 total points
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Database tuning – How to start and what to tune. This question is frequently asked by many people, both online and offline. There is no hard and fast rule-of-thumb for performance tuning, however, before beginning the tuning process one should a…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now