Hi,
I have a table with 5 rows and one column, the columns are formatted in $32759 (maximum allowed).
I need to export this table to txt format but it needs to be all in one row. If I do the proc export or data _null_ file and open the final file, for example with notepad++, I see that there are 5 rows. I have also tried transposing but I always have the same problem.
How can I do this? Obviously without using xcommand.
Thanks a lot!
how about this.
Use put statement with @.
data have;/* sample */
length vars $32759;
do i=1 to 5;
vars=put(i,best.);
output;
end;
drop i;
run;
filename out temp ;
data _null_;
set have;
file out LRECL=163795;
put vars @;
run;
Try something like this:
data _null_;
set sashelp.class(keep=Name) end=lastObs;
file "onerow.txt";
if not lastObs then put Name @;
else put Name;
run;
how about this.
Use put statement with @.
data have;/* sample */
length vars $32759;
do i=1 to 5;
vars=put(i,best.);
output;
end;
drop i;
run;
filename out temp ;
data _null_;
set have;
file out LRECL=163795;
put vars @;
run;
Check RECFM=N option of INFILE or FILENAME ,which could excess the limit of 32767.
data _null_;
set sashelp.class;
file 'c:\temp\want.txt' recfm=n;
put (_all_) (:);
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.