BookmarkSubscribeRSS Feed
sonaaas
Calcite | Level 5

Hi Folks,

 

I have got one requirement in which I need to fetch the data from the oracle tables.

 

Lets suppose I have 5 years of data in the table. 

 

A loop will run for 5 years and when the loop continues for a year ,the subloop will run for 12 months and during the inner loop run ,month and year condition will be applied to the table (under proc sql) filter condition.

 

Any example ,how to do this

 

3 REPLIES 3
LaurieF
Barite | Level 11

No idea I'm afraid. Yet! Can you show some example data, and how you'd like it to appear. Otherwise we're just making random guesses.

Reeza
Super User

See the examples in the Macro Appendix, Example 11 is a starter. 

https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Ap...

 

Also, look into CALL EXECUTE

 

 

Patrick
Opal | Level 21

You will need to be more specific in what you have and what you need in order for us to give you a detailed answer.

 

On a high level: I'd probably consider to generate the SQL with all the filter conditions and then query the Oracle table only once. If you're going for some looping approach then make sure that your date variables in the filter condition are indexed as else you're heading for 5*12 full table scans which can lead to a very poor query performance.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 884 views
  • 1 like
  • 4 in conversation