Solved

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

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
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…
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…

914 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

14 Experts available now in Live!

Get 1:1 Help Now