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!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

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
  • 876 views
  • 0 likes
  • 2 in conversation