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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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