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

Hi all.  I have what I feel should be a simple question, but seem to be struggling to find a way to do it.  Ex:  I have a dataset that contains a list of 10 ID's and I have a separate dataset that contains 6 years of month end dates.  There is not a join key between the 2 files, but I need to have all dates grouped into each ID.

 

Dataset 1 contains list of unique ID's

ID

1

2

3

 

Dataset 2 contains list of month dates

MonthEndDates

Mar 2016

Apr 2016

May 2016

 

I am looking for a way to create this

ID 1  Mar 2016

ID 1 Apr 2016

ID 1 May 2016

...

ID 2 Mar 2016

ID 2 Apr 2016

 

and so on.  Any help would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Satish_Parida
Lapis Lazuli | Level 10

This will work

 

data tab1;
input id;
cards;
1
2
3
;
run;

data tab2;
input mend:date9.;
format mend date9.;
cards;
31Jan2018
28Feb2018
31Mar2018
;
run;

proc sql;
create table want as
select * from tab1,tab2
order by id;
quit;

 

Let us know if it worked for you.

View solution in original post

2 REPLIES 2
Satish_Parida
Lapis Lazuli | Level 10

This will work

 

data tab1;
input id;
cards;
1
2
3
;
run;

data tab2;
input mend:date9.;
format mend date9.;
cards;
31Jan2018
28Feb2018
31Mar2018
;
run;

proc sql;
create table want as
select * from tab1,tab2
order by id;
quit;

 

Let us know if it worked for you.

Scott13
Fluorite | Level 6

It appears that did exactly what I needed.  I am a little embarrassed that it was something so easy...I think I was over complicating it!  Thank you for your help!

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