BookmarkSubscribeRSS Feed
ismahero
Calcite | Level 5


HI...

I have a tale with 4 columns, and I want to stack them and have an output table of just 2 columns.

Example:

Original Table:

SSN                        Code               Spouse SSN                    S Code

111-11-1111             5                 222-22-2222                             6

333-33-3333             5                 444-44-4444                             1

Desired Table:

SSNs                         Codes

111-11-1111                 5

333-33-3333                 5

222-22-2222                 6

444-44-4444                1

Is there any way of doing this...?  Thanks for your help, I am kind of new with SAS EG...

1 REPLY 1
Linlin
Lapis Lazuli | Level 10

try:

data temp1(keep=ssn code) temp2(keep=s_ssn s_code rename=(s_ssn=ssn s_code=code));

set have;

data want;

  set temp1 temp2;

run;

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 901 views
  • 0 likes
  • 2 in conversation