Solved

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

Posted on 2011-09-05
1
474 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
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
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…

773 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