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.
Thanks,
Ana
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()
Hi Tom,
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
Sounds like you have DATETIME field instead of DATE field. What happens if you use DATETIME() function or DHMS(today(),0,0,0) instead?
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:
...and with:
options sastrace=',,,d' sastraceloc=saslog nostsuffix;
Hi Tom,
I tried DATETIME() :
data enter;
FORMAT ENTRY_DT DATETIME20.;
ENTRY_DT = DATETIME();
run;
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.
Thanks,
Ana
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().
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.