BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
yashpande
Obsidian | Level 7
Hi All,

I have oracle table which has date time variable and I need to create sas table with date9 format. Oracle table has more than 30million records. It takes lot of time to extract data due to conversion. Any help in optimization would be really great help
Below is the sample code


Proc sql;
Create table t1 as
Select a.* , b.reporting_date format=date9.
from have left join oracle_lib b
On a. Id=b.id where datepart(b.Reporting_date) =a. Eff_from_date;
Quit;

In another code reporting _date has value like 06Jun2019:00:00:00
Eff_from_date has values like 06-Jun-2019

Any help in reducing the time is of really good help.
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Then you need to redesign your process, did you try my suggested approach, where you first filter based on ID's from a macro variable instead and then filter on dates?

proc sql noprint;
select id into :id_list separated by " "
from have;
quit;

Proc sql;
Create table t1 as
Select id, reporting_date
from oracle_lib a
where a.id in (&id_list.);
Quit;


You also never have an aliased table named A in your code.

View solution in original post

3 REPLIES 3
Reeza
Super User
Where is the HAVE table? If it's not also on the oracle server it's taking a lot of time because linking data between the server and locally first means getting all the data in the same place. If you need to speed it up, I'd run the filter first based on the ID's to reduce the size and then do the date filter in a second step.
yashpande
Obsidian | Level 7
Have table is sas table.
Reeza
Super User
Then you need to redesign your process, did you try my suggested approach, where you first filter based on ID's from a macro variable instead and then filter on dates?

proc sql noprint;
select id into :id_list separated by " "
from have;
quit;

Proc sql;
Create table t1 as
Select id, reporting_date
from oracle_lib a
where a.id in (&id_list.);
Quit;


You also never have an aliased table named A in your code.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 962 views
  • 0 likes
  • 2 in conversation