I want to insert date values in the YYMMDD10. format into my table. Using a DATE9. format works perfectly for a table, also YYMMDD10. successfully displays the correct/desired output via a 'put', but gives error when trying to insert the same into a table.
SCHEMA:
PROC SQL;
Create Table Work.Validation_Rules_Record
(
TEMPLATE_ID varchar ,
RULE_ID varchar ,
INSTANCE_ID NUM,
REPORTING_ENTITY_ID NUM,
**REFERENCE_DATE num informat=yymmdd10. format=yymmdd10.,**
VALIDATION_RESULT varchar ,
VALIDATION_TIME num format=datetime19.2
) ;
QUIT;
%LET date_time=%SYSFUNC( DATETIME() );
%let refr_date='15feb2010'd;
%put %sysfunc(putn(&refr_date,yymmdd10.));
%let ref_date = %sysfunc(putn(&refr_date,yymmdd10.));
%put &ref_date;
The INSERT operation below works when using DATE9. as the format but NOT for YYMMDD10. as shown below.
PROC SQL ;
insert into Work.Validation_Rules_Record
(
TEMPLATE_ID,
RULE_ID,
INSTANCE_ID,
REPORTING_ENTITY_ID,
**REFERENCE_DATE,**
VALIDATION_RESULT,
VALIDATION_TIME
)
Values
(
'C 01.00',
'v_m165' ,
3395,
26,
**"&ref_date"d,**
'C33',
&date_time.
)
;
select * from Work.Validation_Rules_Record ;
QUIT;
Please let me know if you need some more info.
Thanks! KC