Appending three data sets

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 19
Accepted Solution

Appending three data sets

Hi All.

 

I am Appending three data sets namely East, West, North.

Each data sets having six variables with same name.

There is one variable named Rgion which has of length 4 for East and West but of length 5 for North.

 

I have written the below code snippets to appned 

 

data all;

set east west north;

run;

 

The data got appended, but in the region for North its coming Nort.

Why this is coming Nort and how to overcome this.

 

Thanks in advance.

Vishyy

 


Accepted Solutions
Solution
‎04-03-2017 12:41 PM
Super User
Posts: 11,134

Re: Appending three data sets

The lengths of variables will be set by the value in the first data set containing the variable. You should have a note in your log about variables with different lengths and possible truncation of data.

 

You could address that by either ensuring what ever process builds your sets that they have the same characterists before combing or add a Length statement before the SET statement to force all the sets to be treated as having the specified length.

 

data all;

   length Rgion $ 5;

   set east west north;

run;

View solution in original post


All Replies
Solution
‎04-03-2017 12:41 PM
Super User
Posts: 11,134

Re: Appending three data sets

The lengths of variables will be set by the value in the first data set containing the variable. You should have a note in your log about variables with different lengths and possible truncation of data.

 

You could address that by either ensuring what ever process builds your sets that they have the same characterists before combing or add a Length statement before the SET statement to force all the sets to be treated as having the specified length.

 

data all;

   length Rgion $ 5;

   set east west north;

run;

Occasional Contributor
Posts: 14

Re: Appending three data sets

Research Program Data Vector for sas to better understand why this happens

This is an untrained sas user question
☑ This topic is solved.

Need further help from the community? Please ask a new question.

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