<?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: Use variable label as column header for PROC FREQ while suppressing H1 title in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691640#M24842</link>
    <description>Seconding PROC TABULATE which will give you more control over your output directly. Messing around with templates is complicated and gets dangerous - make sure to save a version to restore back your originals in case.</description>
    <pubDate>Wed, 14 Oct 2020 19:07:35 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-10-14T19:07:35Z</dc:date>
    <item>
      <title>Use variable label as column header for PROC FREQ while suppressing H1 title</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691599#M24836</link>
      <description>&lt;P&gt;I'm using PROC TEMPLATE and PROC FREQ to produce a customized frequency table for a variable that has a variable label. I want to use the variable label as the column header of the first column in the resulting table, but I don't want it to appear as the subtitle (h1 title). Is there a way to do this without hard-coding the column header in PROC TEMPLATE?&lt;/P&gt;&lt;P&gt;I first tried the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	set 	sashelp.Class;
	label age='Age at survey';
run;

proc template;
		 edit  base.freq.onewaylist;
			 edit FVariable;                                                       
			 	just=varjust;
				style=rowheader;
				header=varlabel;
			end;
		 end;
run;

ods excel file="PATHNAME\test1.xlsx" 
	options(sheet_name="Female" 
			embedded_titles="yes"
			embed_titles_once="yes");

proc freq data = test(where=(sex="F"));
	tables age;
	title "Age at survey for female participants";
run;

ods excel close;

proc template;
	delete base.freq.onewaylist;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This puts the variable label "Age at survey" correctly as a header of column 1, but it also puts it as a subtitle. See test1 attached. I don't want the subtitle.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know I can leave the subtitle blank using&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
	edit  base.freq.onewaylist;
		edit h1;
			text " ";
		end;
		 edit FVariable;                                                       
		 	just=varjust;
			style=rowheader;
			header=varlabel;
		end;
	 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this still leaves a blank row - see test2 attached. I want to delete that row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the desired output by hardcoding the column header in PROC TEMPLATE and suppressing the variable label in PROC FREQ using&amp;nbsp;label age=" " :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc template;
	edit  base.freq.onewaylist;
		edit FVariable;                                                       
			 just=varjust;
			style=rowheader;
			header='Age at survey';
		end;
	end;
run;

ods excel file="PATHNAME\test3.xlsx" 
	options(sheet_name="Female" 
			embedded_titles="yes"
			embed_titles_once="yes");

proc freq data = test(where=(sex="F"));
	tables age;
	label age=" " ;
	title "Age at survey for female participants";
run;

ods excel close;

proc template;
	delete base.freq.onewaylist;
run;


&lt;/PRE&gt;&lt;P&gt;See test3 for desired output. But this template isn't flexible to be used for other variables.&amp;nbsp;&lt;BR /&gt;Is there a way to produce the same output while using&amp;nbsp;&lt;CODE class=" language-sas"&gt;header=varlabel;&lt;/CODE&gt;&amp;nbsp;when editing&amp;nbsp;FVariable in PROC FREQ? Or is there any other better way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: replaced Excel examples with pdfs&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 14:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691599#M24836</guid>
      <dc:creator>Zoe8SAS</dc:creator>
      <dc:date>2020-10-15T14:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Use variable label as column header for PROC FREQ while suppressing H1 title</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691614#M24841</link>
      <description>&lt;P&gt;I'm not going to open XLSX files from an unknown source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of fighting with templates have you considered another reporting procedure such as Proc Report or Tabulate you can apply styles and such per variable in table descriptions?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 18:05:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691614#M24841</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-14T18:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: Use variable label as column header for PROC FREQ while suppressing H1 title</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691640#M24842</link>
      <description>Seconding PROC TABULATE which will give you more control over your output directly. Messing around with templates is complicated and gets dangerous - make sure to save a version to restore back your originals in case.</description>
      <pubDate>Wed, 14 Oct 2020 19:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691640#M24842</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-10-14T19:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Use variable label as column header for PROC FREQ while suppressing H1 title</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691851#M24865</link>
      <description>&lt;P&gt;Good point! I replaced the Excel files with pdfs. I'll look into report and tabulate. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 14:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691851#M24865</guid>
      <dc:creator>Zoe8SAS</dc:creator>
      <dc:date>2020-10-15T14:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Use variable label as column header for PROC FREQ while suppressing H1 title</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691852#M24866</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this restore the originals?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
	delete base.freq.onewaylist;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Oct 2020 14:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691852#M24866</guid>
      <dc:creator>Zoe8SAS</dc:creator>
      <dc:date>2020-10-15T14:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Use variable label as column header for PROC FREQ while suppressing H1 title</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691873#M24869</link>
      <description>No, that deletes the templates. It's possible SAS has changed how they store it since the last time I messed around with templates but if you run PROC FREQ after running that what happens?</description>
      <pubDate>Thu, 15 Oct 2020 15:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-variable-label-as-column-header-for-PROC-FREQ-while/m-p/691873#M24869</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-10-15T15:27:41Z</dc:date>
    </item>
  </channel>
</rss>

