Solved

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

Posted on 2011-09-04
1
411 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
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Powershell script 13 115
compare between entities in entity framework 8 96
How to design the database - Asp.net mvc code first entity framework 1 53
Very Large data in MYSQL 7 73
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
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…

829 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