<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Exporting wide data with a long header to a delimited file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exporting-wide-data-with-a-long-header-to-a-delimited-file/m-p/639503#M190270</link>
    <description>&lt;P&gt;By not using macro variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=myData
out=contents(keep=name varnum)
noprint;
run;
proc sort data=contents;
  by varnum;
run;
data _null_;
  file 'G:\myPath\output.txt' lrecl=500000 dsd dlm='|';
  set contents end=eof;
  put name @ ;
  if eof then put;
run;   
data _null_;
  file 'G:\myPath\output.txt' lrecl=500000 dsd dlm='|' mod;
  set myData;
  put (_all_)(+0);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Apr 2020 15:39:54 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-04-13T15:39:54Z</dc:date>
    <item>
      <title>Exporting wide data with a long header to a delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-wide-data-with-a-long-header-to-a-delimited-file/m-p/639498#M190268</link>
      <description>&lt;P&gt;I want to export a wide SAS dataset (a few thousand columns and a few hundred thousand rows) to a text file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc contents data=myData
out=contents(keep=name)
noprint;
run;

proc sql noprint;
	select name into :header separated by '|'
	from contents;
quit;
%put NOTE: &amp;amp;=header;

data _null_;
	file 'G:\myPath\output.txt' lrecl=500000 dsd dlm='|';
	set myData;
	IF _N_=1 THEN PUT "%BQUOTE(&amp;amp;header)";
 	put (_all_)(+0);
run;&lt;/PRE&gt;&lt;P&gt;This would work in theory, however, my header is over 32,767 characters long and is truncated. How can I modify these statements to ensure the whole header is written to the output file?&lt;/P&gt;&lt;P&gt;This is on SAS 9.4.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 15:35:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-wide-data-with-a-long-header-to-a-delimited-file/m-p/639498#M190268</guid>
      <dc:creator>jimbo2</dc:creator>
      <dc:date>2020-04-13T15:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting wide data with a long header to a delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-wide-data-with-a-long-header-to-a-delimited-file/m-p/639503#M190270</link>
      <description>&lt;P&gt;By not using macro variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=myData
out=contents(keep=name varnum)
noprint;
run;
proc sort data=contents;
  by varnum;
run;
data _null_;
  file 'G:\myPath\output.txt' lrecl=500000 dsd dlm='|';
  set contents end=eof;
  put name @ ;
  if eof then put;
run;   
data _null_;
  file 'G:\myPath\output.txt' lrecl=500000 dsd dlm='|' mod;
  set myData;
  put (_all_)(+0);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Apr 2020 15:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-wide-data-with-a-long-header-to-a-delimited-file/m-p/639503#M190270</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-13T15:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting wide data with a long header to a delimited file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-wide-data-with-a-long-header-to-a-delimited-file/m-p/639504#M190271</link>
      <description>&lt;P&gt;You may need to share which SAS system you are operating under.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may be worth trying a FILENAME statement to create a file reference instead of using the file statement in the data step to set properties. No promise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And did you try Proc Export by any chance?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 15:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-wide-data-with-a-long-header-to-a-delimited-file/m-p/639504#M190271</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-13T15:42:22Z</dc:date>
    </item>
  </channel>
</rss>

