12-16-2016 08:13 PM
Hi SAS users,
A filed "ENTRY_DT" is built as date format in Oracle Database, i am trying to load current date in YYYY-MM-DD format .
I tried to convert it into character with put function & also input function. still getting te below error, where it is inserting the records into table.
ENTRY_DT = put(today(),YYMMDD10.);
ERROR: ENTRY_DT, a numeric column, can only be updated with a numeric expression.
12-16-2016 08:31 PM - edited 12-16-2016 08:32 PM
Just assign the date value to the variable. What format you use to display a date does not change the value that is stored in the SAS dataset (or ORACLE table).
entry_dt = today()
12-16-2016 09:18 PM
Jus loading today() in the entry_dt field is giving resulsts like "1/1/1960 time". I wanted them to be "YYYY- MM-DD" format & also todays date
12-16-2016 11:05 PM
Please post your full code of how you want to load this date value into Oracle.
Be aware that a DATE column in Oracle maps to a SAS DateTime value (and NOT a SAS Date value) and though the value to load should be datetime().
If you're interacting with Oracle then make yourself also familiar with:
options sastrace=',,,d' sastraceloc=saslog nostsuffix;
12-19-2016 01:48 PM
I tried DATETIME() :
FORMAT ENTRY_DT DATETIME20.;
ENTRY_DT = DATETIME();
I am getting full date and time being printed in the tables. (12/19/2016 12:39:26 PM) I want it to be YYYY-MM-DD format. Table has Date format for this variable ENTRY_DT.
12-19-2016 07:55 PM
If you want SAS to display only the date part of your datetime values you can use the DTDATE format instead of the DATETIME format.
If you to store only the date part of the current datetime time then store DHMS(TODAY(),0,0,0) instead of DATETIME().