Hi:
The key may be having an explicit LENGTH statement for your long text variable. I had this example that uses CATX, but without BY group processing that shows the use of the LENGTH statement set to $4000.
The length of a character variable is limited to 32,767 characters or bytes, as explained here:
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001336069.htm
cynthia
data singlevar;
length sentence $100 ;
infile datalines dsd dlm=',';
input sentence $;
len_sent = length(sentence);
origord = _n_;
return;
datalines;
"Twas brillig and the slithy toves"
"Did gyre and gimble in the wabe"
"All mimsy were the borogroves"
"And the mome raths outgrabe"
"Beware the Jabberwock, my son!"
"The jaws that bite, the claws that catch!"
"Beware the Jubjub bird, and shun"
"The frumious Bandersnatch!"
"He took his vorpal sword in hand:"
"Long time the manxome foe he sought --"
"So rested he by the Tumtum tree,"
"And stood awhile in thought."
"And, as in uffish thought he stood,"
"The Jabberwock, with eyes of flame,"
"Came whiffling through the tulgey wood,"
"And burbled as it came!"
"One, two! One, two! And through and through"
"The vorpal blade went snicker-snack!"
"He left it dead, and with its head"
"He went galumphing back."
"And, has thou slain the Jabberwock?"
"Come to my arms, my beamish boy!"
"O frabjous day! Callooh! Callay!"
"He chortled in his joy."
;
run;
ods listing;;
proc print data=singlevar;
run;
data bigvar(keep=longtext);
length longtext $4000;
retain longtext;
set singlevar end=eof;
longtext = catx(' ', longtext,sentence);
if eof=1 then output;
run;
ods listing close;
ods html file='c:\temp\show_bigvar.html' style=sasweb;
proc print data=bigvar;
title 'BIGVAR';
run;
ods _all_ close;
title;
Hi:
The key may be having an explicit LENGTH statement for your long text variable. I had this example that uses CATX, but without BY group processing that shows the use of the LENGTH statement set to $4000.
The length of a character variable is limited to 32,767 characters or bytes, as explained here:
http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/a001336069.htm
cynthia
data singlevar;
length sentence $100 ;
infile datalines dsd dlm=',';
input sentence $;
len_sent = length(sentence);
origord = _n_;
return;
datalines;
"Twas brillig and the slithy toves"
"Did gyre and gimble in the wabe"
"All mimsy were the borogroves"
"And the mome raths outgrabe"
"Beware the Jabberwock, my son!"
"The jaws that bite, the claws that catch!"
"Beware the Jubjub bird, and shun"
"The frumious Bandersnatch!"
"He took his vorpal sword in hand:"
"Long time the manxome foe he sought --"
"So rested he by the Tumtum tree,"
"And stood awhile in thought."
"And, as in uffish thought he stood,"
"The Jabberwock, with eyes of flame,"
"Came whiffling through the tulgey wood,"
"And burbled as it came!"
"One, two! One, two! And through and through"
"The vorpal blade went snicker-snack!"
"He left it dead, and with its head"
"He went galumphing back."
"And, has thou slain the Jabberwock?"
"Come to my arms, my beamish boy!"
"O frabjous day! Callooh! Callay!"
"He chortled in his joy."
;
run;
ods listing;;
proc print data=singlevar;
run;
data bigvar(keep=longtext);
length longtext $4000;
retain longtext;
set singlevar end=eof;
longtext = catx(' ', longtext,sentence);
if eof=1 then output;
run;
ods listing close;
ods html file='c:\temp\show_bigvar.html' style=sasweb;
proc print data=bigvar;
title 'BIGVAR';
run;
ods _all_ close;
title;
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.