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

Good Morning,

I have a SAS dataset that contains the following columns:

EmployeeID

Month1_Date

Month2_Date

Month3_Date

Month1_Target

Month2_Target

Month3_Target

I would like it so a new dataset would just show EmployeeID Date Target so for each row in the original dataset, there will be 3 rows in the resultant dataset.

For Example:

Original Dataset

EmployeeID     Month1_Date     Month2_Date     Month3_Date     Month1_Target     Month2_Target     Month3_Target

123                    1SEP2014          1OCT2014          1NOV2014          0.75                    0.85                         0.90

Desired Dataset

EmployeeID     Month          Target

123                 1SEP2014     0.75

123                 1OCT2014     0.85

123                 1NOV2014     0.90

Kind Regards,


1 ACCEPTED SOLUTION

Accepted Solutions
Jagadishkatam
Amethyst | Level 16

Please try

data want;

set have;

array dat(3) Month1_Date Month2_Date Month3_Date;

array tar(3) Month1_Target Month2_Target  Month3_Target;

do i = 1 to 3;

Month = dat(i);

target= tar(i);

output;

end;

format month date9.;

keep EmployeeID month target;

run;

Thanks,

Jag

Thanks,
Jag

View solution in original post

2 REPLIES 2
Jagadishkatam
Amethyst | Level 16

Please try

data want;

set have;

array dat(3) Month1_Date Month2_Date Month3_Date;

array tar(3) Month1_Target Month2_Target  Month3_Target;

do i = 1 to 3;

Month = dat(i);

target= tar(i);

output;

end;

format month date9.;

keep EmployeeID month target;

run;

Thanks,

Jag

Thanks,
Jag
cxkev
Fluorite | Level 6

Perfect, Thanks

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
  • 793 views
  • 1 like
  • 2 in conversation