BookmarkSubscribeRSS Feed
gsk
Obsidian | Level 7 gsk
Obsidian | Level 7

data data3;

  set data1 data2; 

run;

 

From my understanding, if data1 and data2 have 10 observations respectively, data3 should return 20 observations. However, after running the statement, I get only 15 observations.

 

Let's say those two datasets are actually datasets about students. One student with student id=1 has 4 observations in data1 and 1 observation in data2. After running the data step, I get the records that belong to student id=1 all deleted in data3. 

 

Can anyone please help figuring out why this might be? 

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Please provide us with the data sets used (or a reasonable fraction of them that illustrates the problem). Use these instructions: How to create a data step version of your data AKA generate sample data for forums

 

Also please show us the EXACT code that is being used.

--
Paige Miller
Reeza
Super User
Show your log with the issue. I'm guessing it terminated due to an error in your code and you're looking at partial output.

Otherwise, please provide some code that replicates the issue.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 587 views
  • 1 like
  • 3 in conversation