BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vfarmak
Quartz | Level 8

Greetings Everyone!

 

I have the following problem:

  1. I have created an job in SAS DI which receives two parameters of type Date
  2. The job uses many times components such Extract to filter SAS Datasets. In order to filter the SAS Dataset the following construct in the where clause is used "<start_date>"d
  3. The field used in the filter is of type Numeric with format Date9.
  4. When I try to add the following job in a Loop that contains a control table with numeric dates of type DATE9. it simply presents me the following error:

ERROR: Invalid date/time/datetime constant "21914"d.

 

It seems that the parameter is read, but in the extract component is read as numeric.

 

To tackle the previous workaround I have tried the following solutions:

  1. Add the below line in the precode section of the job with the parameters. The following did not work (see the code below - Example 1)
  2. Use the sysfunc as illustrated in the example 2
/*Example 1*/ 
data _null_;
call symputx('business_load_from', put(business_load_from, date9.));
call symputx('business_load_to', put(business_load_to, date9.));
run;

Example 2

%let date = %sysfunc(&business_load_from, date9.);
%put &date.;

Does anyone has faced the aforementioned problem?

Any recommendations are welcome.

 

Best Regards,

Vasileios

1 ACCEPTED SOLUTION

Accepted Solutions
vfarmak
Quartz | Level 8

Guys no worries, 

 

I found the solution: I had to simply perform the transformation in the pre-code segment of the job before the macro variable assignments

data _null_;
call symputx('start_date', put(&start_date, date9.));
call symputx('end_date', put(&end_date, date9.));
run;

%let load_from = &start_date;
%let load_to       = &end_date;

It seems that during my effort when I was describing the comment, I found out the workaround!

Cheers!

 

View solution in original post

1 REPLY 1
vfarmak
Quartz | Level 8

Guys no worries, 

 

I found the solution: I had to simply perform the transformation in the pre-code segment of the job before the macro variable assignments

data _null_;
call symputx('start_date', put(&start_date, date9.));
call symputx('end_date', put(&end_date, date9.));
run;

%let load_from = &start_date;
%let load_to       = &end_date;

It seems that during my effort when I was describing the comment, I found out the workaround!

Cheers!

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 369 views
  • 0 likes
  • 1 in conversation