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

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

2 REPLIES 2
ballardw
Super User

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;

PatrickCuba
Obsidian | Level 7
Research Program Data Vector for sas to better understand why this happens

This is an untrained sas user question

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 501 views
  • 1 like
  • 3 in conversation