BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fongdo
Obsidian | Level 7

I would like to merge two data sets as  an example below. Could you kindly advise? 

Thank you very much in advance

 

HAVE_1

FIRM

1

2

 

HAVE_2

DATE

12/08/2017

22/12/2018

06/10/2019

 

WANT

FIRM                     DATE

1                         12/08/2017

1                         22/12/2018

1                         06/10/2019

2                         12/08/2017

2                         22/12/2018

2                         06/10/2019

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Try cartesian

 

proc sql;
create table want as
select firm, date
from have_1, have_2;
quit;

View solution in original post

4 REPLIES 4
novinosrin
Tourmaline | Level 20

Try cartesian

 

proc sql;
create table want as
select firm, date
from have_1, have_2;
quit;
fongdo
Obsidian | Level 7

Many thanks @novinosrin Smiley Happy

PeterClemmensen
Tourmaline | Level 20
data have_1;
input firm;
datalines;
1
2
;

data have_2;
input date :ddmmyy10.;
format date ddmmyy10.;
datalines;
12/08/2017
22/12/2018
06/10/2019
;

data want;
   set have_1;
   do i=1 to n;
      set have_2 point=i nobs=n;
      output;
   end;
run;
fongdo
Obsidian | Level 7

Thank a lot @PeterClemmensen 

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

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1419 views
  • 2 likes
  • 3 in conversation