<?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: PROC PRINT - prevent column headings from spilling onto second row in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204769#M51009</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; The main issue is that Excel will not like the column widths if you use ODS and will "pick" a general column width. And, I believe it does this with the EXPORT method too. I do have some other suggestions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;1) if you are creating output for Excel, I recommend using ODS MSOFFICE2K as the destination. Microsoft did not agree with the standard HTML 4.0 specification (which is what ODS HTML creates) and the ODS MSOFFICE2K destination creates the kind of HTML tags that conform to Microsoft HTML&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;2) You can explicitly change the width of the cells so that the header has more room:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc print data = xxxxx.yyyyy label noobs&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; style(data)={width=2in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; var onevar twovar;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; var redvar bluevar / style(data)={width=1.5in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc report data = xxxxx.yyyyy nowd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; style(column)={width=2in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; column onevar twovar redvar bluevar;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define redvar / style(column)={width=1.5in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define bluevar / style(column)={width=1.5in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) I have more about overriding Excel defaults in this paper:&lt;A href="https://support.sas.com/resources/papers/proceedings11/266-2011.pdf" title="https://support.sas.com/resources/papers/proceedings11/266-2011.pdf"&gt;https://support.sas.com/resources/papers/proceedings11/266-2011.pdf&lt;/A&gt;&amp;nbsp; (covers leading zeroes, column width, decimal points, percent signs, etc)&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Apr 2015 22:56:18 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2015-04-27T22:56:18Z</dc:date>
    <item>
      <title>PROC PRINT - prevent column headings from spilling onto second row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204765#M51005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am wondering if anyone can provide guidance on an issue I have encountered when using PROC PRINT to print tables into an Excel format (via ODS).&amp;nbsp; It pertains to the header rows.&amp;nbsp; I am running SAS 9.2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On occasion, some of my headers spill onto a second row, as observed when exporting to Excel, despite the fact that I am NOT specifying a split= character.&amp;nbsp; As one example, I have some SAS output (exported to Excel) in which the label for the last column is split between two rows.&amp;nbsp; For purposes of copying and pasting this data into a separate standard delivery template, it would be preferable for all labels to always fit within a single row without wrapping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My PROC PRINT code is as follows - pretty basic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc print data = final label noobs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; format distpercentchange countpercentchange percentn10.1 &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;count1 count2 comma10.;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; var rankcirc mfrname distpercentchange count1 count2 countpercentchange;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; label rankcirc = 'Rank'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mfrname = 'Manufacturer'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; distpercentchange = "&amp;amp;period YOY % Change"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count1 = "&amp;amp;lastyear Offer Count"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count2 = "&amp;amp;thisyear Offer Count"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; countpercentchange = "Offer Count YOY % Change";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are there any thoughts as to whether there are any options or alternative methods that I can consider using to force my headings onto a single row?&amp;nbsp; Is there any other information that I can provide?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much!&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 16:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204765#M51005</guid>
      <dc:creator>cbal324</dc:creator>
      <dc:date>2015-04-27T16:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINT - prevent column headings from spilling onto second row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204766#M51006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How are you exporting to Excel? Tagsets.Excelxp or HTML and opening in Excel or something else?&lt;/P&gt;&lt;P&gt;The ods settings do have an impact on choices.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 16:55:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204766#M51006</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-27T16:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINT - prevent column headings from spilling onto second row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204767#M51007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the response!&amp;nbsp; Good question - for this, I am simply using HTML and opening in Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods html file = "G:\path\filename.xls";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* proc print, etc.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods html close;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 17:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204767#M51007</guid>
      <dc:creator>cbal324</dc:creator>
      <dc:date>2015-04-27T17:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINT - prevent column headings from spilling onto second row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204768#M51008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can recreate your problem using SASHELP.CLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=sashelp.class label noobs ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; label name='This label is longer than the column width';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not just use PROC EXPORT to write an XLS (or better XLSX) file directly from the data instead of using PROC PRINT?&lt;/P&gt;&lt;P&gt;Or write a real (or at least closer to real) Excel file by using ODS tagsets.excelxp or the new ODS Excel .&lt;/P&gt;&lt;P&gt;Or use a proc like PROC REPORT that will let you specify the column width and the data format separately.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 21:43:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204768#M51008</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-04-27T21:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINT - prevent column headings from spilling onto second row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204769#M51009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; The main issue is that Excel will not like the column widths if you use ODS and will "pick" a general column width. And, I believe it does this with the EXPORT method too. I do have some other suggestions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;1) if you are creating output for Excel, I recommend using ODS MSOFFICE2K as the destination. Microsoft did not agree with the standard HTML 4.0 specification (which is what ODS HTML creates) and the ODS MSOFFICE2K destination creates the kind of HTML tags that conform to Microsoft HTML&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;2) You can explicitly change the width of the cells so that the header has more room:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc print data = xxxxx.yyyyy label noobs&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; style(data)={width=2in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; var onevar twovar;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; var redvar bluevar / style(data)={width=1.5in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc report data = xxxxx.yyyyy nowd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; style(column)={width=2in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; column onevar twovar redvar bluevar;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define redvar / style(column)={width=1.5in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define bluevar / style(column)={width=1.5in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) I have more about overriding Excel defaults in this paper:&lt;A href="https://support.sas.com/resources/papers/proceedings11/266-2011.pdf" title="https://support.sas.com/resources/papers/proceedings11/266-2011.pdf"&gt;https://support.sas.com/resources/papers/proceedings11/266-2011.pdf&lt;/A&gt;&amp;nbsp; (covers leading zeroes, column width, decimal points, percent signs, etc)&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2015 22:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204769#M51009</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2015-04-27T22:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC PRINT - prevent column headings from spilling onto second row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204770#M51010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your assistance on this!&amp;nbsp; I found that in my particular case, explicitly changing the cell widths within PROC PRINT still did not result in the desired output.&amp;nbsp; Even after shrinking the font size for good measure, one of my headings insisted on wrapping onto two rows despite having an abundance of space to fit onto one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It turns out that for my specific needs, PROC REPORT provides a little more versatility with regard to customizing my output.&amp;nbsp; After simply converting my PROC PRINT step into a PROC REPORT step, the headings appear exactly as desired while the data itself is shown exactly as it was before.&amp;nbsp; So my very quick and easy solution will be to use PROC REPORT for my exports to Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc report nowd data = final;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; column rankcirc mfrname distpercentchange count1 count2 countpercentchange;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; define rankcirc / "Rank";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; define mfrname / "Manufacturer";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; define distpercentchange / format=percentn10.1 "&amp;amp;period YOY % Change";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; define count1 / format=comma10. "&amp;amp;lastyear Offer Count";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; define count2 / format=comma10. "&amp;amp;thisyear Offer Count";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; define countpercentchange / format=percentn10.1 "Offer Count YOY % Change";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for all of the great suggestions!&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2015 16:31:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-PRINT-prevent-column-headings-from-spilling-onto-second-row/m-p/204770#M51010</guid>
      <dc:creator>cbal324</dc:creator>
      <dc:date>2015-04-28T16:31:14Z</dc:date>
    </item>
  </channel>
</rss>

