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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1320 views
  • 0 likes
  • 2 in conversation