BookmarkSubscribeRSS Feed
KatWinSASland
Calcite | Level 5

I recently started using an AWS credential to access data in a cloud database. Currently we are dealing with a limitation where we get timed out after 1 hour. (Not really what I need help with, but just to give some context why I am approaching the issue this way).  This only allows me to pull about 1 million or so records at a time if I do a limit 1000000 statement at the end of the query. I don't have other fields that would make good filters to split the dataset up. Is there a way to pull the first million in one query, then make sure I am pulling the next million, so on and so forth. I can see how many records there are in each monthly table, so if I can do these pulls sequentially I should be able to pull all the records separately to address the credential issue. 

 

 

2 REPLIES 2
SASKiwi
PROC Star

Yours is the second recent post on this topic. Here is the other one that may be of some help: https://communities.sas.com/t5/SAS-Programming/How-to-Stop-amp-Restart-Query-Every-30-min/m-p/922572...

 

The obvious question is why can't the time out limit be changed? This could be the result of a firewall rule for example. I suggest you check with your SAS administrator before spending a lot of time working around this limitation - better to cure the disease rather than deal with the symptom.

Kurt_Bremser
Super User

Using FIRSTOBS= and OBS= dataset options:

%macro get_chunk(n);
data chunk&n.;
set source.table (firstobs=%eval(&n. * 1000000 + 1) obs=%eval((&n. + 1) * 1000000));
run;
%mend;

%get_chunk(0)
%get_chunk(1)
...

You need to add code that sets the correct OBS= value for the last chunk.

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!

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.

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
  • 2 replies
  • 255 views
  • 0 likes
  • 3 in conversation