BookmarkSubscribeRSS Feed
MargoBlue
Fluorite | Level 6

I have a macro: %macro tab(start_date, periods), which creates multiple views dependent on the start date and number of periods.

For example: %tab(201701, 36) creates views: tab_201701, tab_201702,tab_201703,...tab_201912, tab_202001.

 

I want to concatenante this views and create table:

data all_tab;
set WORK.tab_:;
by id1 id2;
run;

/*or*/

data all_tab;
set WORK.tab_: open=defer;
run;

But these views have about from 700 thousands to 1,2 milion records and (only :)) 3 columns.

It takes a long time, and start date as well as number of periods can change (even start_date =201201), so the numer of views can be different. I know that I can create another view as: data all_tab/view=all_tab; ,

but I need the table - to make some operations on its later.

Could you tell me what is better way to make this data step more efficient?:

data all_tab;

set WORK.tab_:;

by id1 id2;

run;

 

I've read about hash tables but I don't know how use it to concatenate views WORK.tab_: and if it works on views.

Thank you in advance.

 

2 REPLIES 2
Reeza
Super User
PROC APPEND will be slightly faster but if you're appending 36 files that are each about 1 million records your main file will be 36 million records, which is a big file, think a few gigabytes.

It all really depends on what you're doing next.
Reeza
Super User
PROC APPEND will be slightly faster but if you're appending 36 files that are each about 1 million records your main file will be 36 million records, which is a big file, think a few gigabytes.

It all really depends on what you're doing next.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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