Solved

Populating a text field with the date value from a datetime field

Posted on 2011-09-05
1
504 Views
Last Modified: 2013-11-16
I reading in  DATEA ,FIELDA, FIELDB in a dataset.  Both FIELDA and FIELDB are text fields.
DATEA is a DATETIME Field.

If FIELDA is = "Y" and FIELDB is not populated I would like to move the DATEPART of DATEA to FIELDB.

How can I do this:  When I  just write the statement
FIELDB = datepart(DATEA)  I get 18884.  I  would like for this value to be able to formatted into a date in the text field FIELDB.

I would like to final result in FIELDB to be 8/15/2011.
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: 36486176
data [output];
  set [input]'
  if FIELDA eq 'Y' and FIELDB eq "" then
    FIELDB = PUT(DATEPART(DATEA), mmddyy10.);
run;
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
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…

634 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