Solved

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

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

This article describes some very basic things about SQL Server filegroups.
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
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…

828 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