Hello everyone!! I'm trying to import a text file corresponding to a legal document. The file has approximately 125,000 characters in total, across almost 2,000 lines. I have managed to load the file to CAS into a table with one observation per record. What I need to do is to concatenate all the data into a single variable, e.g.: If the file contains the following: This
is
a
sample
text I want to get a dataset consisting of one variable and one row, like this: Text This is a sample text I have come up with the following code: cas mySession sessopts=(caslib=casuser timeout=1800 locale="en_US" metrics=true);
libname myCas cas caslib=casuser;
filename archivo "/path/to/file/file.txt" ;
data myCas.archivo1;
length linea varchar(*);
infile archivo
delimiter='0D0A'x
DSD
;
input linea $;
run;
data myCas.archivo2(drop=linea);
length linea texto varchar(*);
set myCas.archivo1 end=eof;
retain texto;
if not missing(linea) then
texto = catx(" ",texto,linea);
if eof then output;
run; But, the resulting variable "texto" contains only 37486 characters. Thanks a lot, guys! Andres V.
... View more