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

Hi,

I am using proc append in a macro. 

My base data is an empty data:

data1;

input message $120;

run;

 

data2;

message = 'A message less than 120 characters';

run;

 

proc append base = data1 data = data2 force;

run;

 

even though I set my base data length to be a lot longer than appending data, the message after proc append force is trimmed to "A", which is the first letter in the message. Can someone explain why that happens? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

@laiguanyu001 wrote:

Hi,

I am using proc append in a macro. 

My base data is an empty data:

data1;

input message $120;

run;

 

data2;

message = 'A message less than 120 characters';

run;

 

proc append base = data1 data = data2 force;

run;

 

even though I set my base data length to be a lot longer than appending data, the message after proc append force is trimmed to "A", which is the first letter in the message. Can someone explain why that happens? Thanks!


The code to make the empty data set is not right.  Try something like this.

 

data data1;
   stop;
   length message $120;
   run;

View solution in original post

2 REPLIES 2
data_null__
Jade | Level 19

@laiguanyu001 wrote:

Hi,

I am using proc append in a macro. 

My base data is an empty data:

data1;

input message $120;

run;

 

data2;

message = 'A message less than 120 characters';

run;

 

proc append base = data1 data = data2 force;

run;

 

even though I set my base data length to be a lot longer than appending data, the message after proc append force is trimmed to "A", which is the first letter in the message. Can someone explain why that happens? Thanks!


The code to make the empty data set is not right.  Try something like this.

 

data data1;
   stop;
   length message $120;
   run;
laiguanyu001
Fluorite | Level 6
Thanks this works!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 777 views
  • 0 likes
  • 2 in conversation