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

Hello Everyone 

 

I have two SAS datasets 

 

dataset 1.          dataset 2

1.                         4

2                          5

3                          6

 

I want to stack these on top of each other so that the final dataset looks as follows. 

 

Final dataset

1

2

3

4

5

6

 

I appreciate your help.

1 ACCEPTED SOLUTION

Accepted Solutions
sustagens
Pyrite | Level 9

Try

data want;
set dataset1 dataset2;
run;

View solution in original post

4 REPLIES 4
sustagens
Pyrite | Level 9

Try

data want;
set dataset1 dataset2;
run;
GreenTree1
Obsidian | Level 7
Perfect, It worked!! thanks sustagens
ballardw
Super User

A single column will only work if 1) the variable has the same name and 2) the same-named variable has the same type (numeric or character) in both data sets.

 

If the values have different lengths in the two sets you may get a warning about different lengths in the log and possible truncation of the data. Do not ignore that warning. Verify that the result is as needed.

GreenTree1
Obsidian | Level 7
Thank you for pointing this Ballardw, the datasets were identical in variables and variable type so it worked out well

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

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