Solved

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
UNION query Teradata - error 2 46
date of death fact tbl or dimension? 15 69
oracle query help 29 64
Display multiple images in report 12 85
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Creating and Managing Databases with phpMyAdmin in cPanel.
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now