BookmarkSubscribeRSS Feed
DangIT
Fluorite | Level 6

Hi,

I feel like i'm stuck on something so simple, and I just dont know why...

I have 2 data sets

FSALDU table

A1A1A1

A1B1B1

... 800,000 records

Date table

2013-01-01

2013-02-01

.. (365 days)

I would like to create a table that merges the two, where date is repeated across all FSALDU's

FSALDU Date

A1A1A1 2013-01-01

A1A1A1 2013-01-02

A1A1A1 2013-01-03

...  (800,000*365=292M records)

Your help greatly appreciated, thanks in advance.

KD

2 REPLIES 2
ballardw
Super User

Proc sql;

     create table want as

     select FSALDU,DATE

     from name_of_dataset_with_fsaldu_goes_Here join name_of_date_table;

quit;

You'll get a message in the log about a full cartesian join and it will take some time.

But another option would be:

Data want;

     set name_of_dataset_with_fsaldu_goes_Here;

     do date = '01JAN2013'd to '31DEC2013'd;

          output;

     end;

     format date yymmdd10.;

run;

might be quicker. Also when you need to modify the process to incude a leap year SAS does that because it knows which years, or at least for the next 10,000 or so, which will need a leap day and you needn't build a new dates data set.    

DangIT
Fluorite | Level 6

Thank you! I knew it was something so simple i was missing.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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