You can look at the data step that PROC EXPORT writes but I don't think it will create a file with an LRECL > 32767 perhaps you could edit the program.
This data step works for 20,000 variables I'm still waiting the job to start with 2M variables. The calculation for LRECL in the program is a bit arbitrary so you will need to think about that a bit. You just want to make sure the you don't FLOWOVER. You can set the value arbitrarily high and but that will just cost you more memory.
%let n=2000000;
data M2;
length ID $16.;
array val[&n] (1:&n);
do _n_ = 1 to 4;
id = put(_n_,z16.);
output;
end;
run;
filename m2 '~/m2.csv' lrecl=%sysevalF(16*&n);
data _null_;
set m2;
file m2 dsd;
if _n_ eq 1 then link _names_;
put (_all_)(:);
return;
_names_:
length _name_ $32;
do while(1);
call vnext(_name_);
if _name_ eq '_name_' then leave;
put _name_ @;
end;
put;
return;
run;
Just replace your PROC EXPORT with a data step to write the header.
filename snp "C:\Users\Maja\Desktop\gv50.csv";
data _null_ ;
file snp dsd lrecl=10000000 ;
put 'id' @;
do i=1 to 2000000;
name = cats('snp',i);
put name @;
end;
put;
run;
data _null_ ;
file snp dsd lrecl=10000000 mod ;
set bikovi;
put ( id snp1-snp2000000 ) (+0) ;
run;
(or do it in the other data step)
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.