Solved

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

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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

622 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