<?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: saving the label from PROC in ODS OUTPUT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734194#M228753</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data output;
    set output;
    label = vlabelx(scan(table,2,' '));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Apr 2021 11:23:12 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-04-15T11:23:12Z</dc:date>
    <item>
      <title>saving the label from PROC in ODS OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734167#M228749</link>
      <description>&lt;P&gt;I run PROC SURVEYFREQ to get the frequencies for two age groups. The output from PROC SURVEYFREQ has the label of my age_group variable which is "How old are you?". However, the only output data from my PROC SURVEYFREQ:&amp;nbsp;OneWay=Output does not show the label of the variable anymore. I want to use the output from my ODS OUTPUT step in a report and I would like to keep the label for my original variable. I have so many variables and I would like to use a macro and not type the labels as a TITLE or one by one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, if I can remove the first row of my PROC SURVEYFREQ table, or edit its content (to remove the "Table of age_group" part and keep only the "How old are you" part), I use that one instead of the output from ODS OUTPUT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods trace on;&lt;BR /&gt;proc surveyfreq data = &amp;amp;dataset VARHEADER = NAMELABEL nosummary;&lt;BR /&gt;tables age_group/cl nofreq nostd; &lt;BR /&gt;weight &amp;amp;weight_var;&lt;BR /&gt;run;&lt;BR /&gt;ods trace off;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV class="c proctitle"&gt;The SURVEYFREQ Procedure&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Surveyfreq: One-Way Distribution" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="5" scope="colgroup"&gt;Table of age_group(How old are you?)&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l b header" scope="col"&gt;age_group(How old are you?)&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Weighted&lt;BR /&gt;Frequency&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Percent&lt;/TH&gt;
&lt;TH class="c b header" colspan="2" scope="colgroup"&gt;95% Confidence Limits&lt;BR /&gt;for Percent&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;10-15&lt;/TH&gt;
&lt;TD class="r data"&gt;126&lt;/TD&gt;
&lt;TD class="r data"&gt;50.9&lt;/TD&gt;
&lt;TD class="r data"&gt;48.3&lt;/TD&gt;
&lt;TD class="r data"&gt;53.5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;16-20&lt;/TH&gt;
&lt;TD class="r data"&gt;121&lt;/TD&gt;
&lt;TD class="r data"&gt;49.1&lt;/TD&gt;
&lt;TD class="r data"&gt;46.5&lt;/TD&gt;
&lt;TD class="r data"&gt;51.7&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Total&lt;/TH&gt;
&lt;TD class="r data"&gt;247&lt;/TD&gt;
&lt;TD class="r data"&gt;100.0&lt;/TD&gt;
&lt;TD class="r data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="r data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods output OneWay=Output; &lt;BR /&gt;proc surveyfreq data = &amp;amp;dataset VARHEADER = NAMELABEL nosummary;&lt;BR /&gt;tables age_group/cl nofreq nostd; &lt;BR /&gt;weight &amp;amp;weight_var;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc print data=output; run;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.OUTPUT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Table&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;F_age_group&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;age_group&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;WgtFreq&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;Percent&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;LowerCL&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;UpperCL&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;_SkipLine&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;Table age_group&lt;/TD&gt;
&lt;TD class="l data"&gt;10-15&lt;/TD&gt;
&lt;TD class="r data"&gt;10-15&lt;/TD&gt;
&lt;TD class="r data"&gt;126&lt;/TD&gt;
&lt;TD class="r data"&gt;50.9&lt;/TD&gt;
&lt;TD class="r data"&gt;48.3&lt;/TD&gt;
&lt;TD class="r data"&gt;53.5&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;Table&amp;nbsp;age_group&lt;/TD&gt;
&lt;TD class="l data"&gt;16-20&lt;/TD&gt;
&lt;TD class="r data"&gt;16-20&lt;/TD&gt;
&lt;TD class="r data"&gt;121&lt;/TD&gt;
&lt;TD class="r data"&gt;49.1&lt;/TD&gt;
&lt;TD class="r data"&gt;46.5&lt;/TD&gt;
&lt;TD class="r data"&gt;51.7&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data"&gt;Table&amp;nbsp;age_group&lt;/TD&gt;
&lt;TD class="l data"&gt;Total&lt;/TD&gt;
&lt;TD class="r data"&gt;.&lt;/TD&gt;
&lt;TD class="r data"&gt;247&lt;/TD&gt;
&lt;TD class="r data"&gt;100.0&lt;/TD&gt;
&lt;TD class="r data"&gt;_&lt;/TD&gt;
&lt;TD class="r data"&gt;_&lt;/TD&gt;
&lt;TD class="l data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Apr 2021 10:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734167#M228749</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-04-15T10:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: saving the label from PROC in ODS OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734194#M228753</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data output;
    set output;
    label = vlabelx(scan(table,2,' '));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Apr 2021 11:23:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734194#M228753</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-15T11:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: saving the label from PROC in ODS OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734199#M228756</link>
      <description>&lt;P&gt;Have you checked that the variable label is empty?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 11:31:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734199#M228756</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-15T11:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: saving the label from PROC in ODS OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734280#M228766</link>
      <description>Thank you, ChrisNZ. Yes, the variable labels are there. The code from Paige Miller adds a column with the label.</description>
      <pubDate>Thu, 15 Apr 2021 13:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734280#M228766</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-04-15T13:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: saving the label from PROC in ODS OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734281#M228767</link>
      <description>Thank you, Paige Miller! It works perfectly! May you please help me to understand the scan(table,2,' ') part?</description>
      <pubDate>Thu, 15 Apr 2021 13:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734281#M228767</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-04-15T13:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: saving the label from PROC in ODS OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734282#M228768</link>
      <description>&lt;P&gt;&amp;nbsp;The value of variable TABLE is the text string&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Table age_group&lt;/PRE&gt;
&lt;P&gt;and so &lt;FONT face="courier new,courier"&gt;scan(table,2,' ')&lt;/FONT&gt; finds the second "word", which is the text string &lt;FONT face="courier new,courier"&gt;age_group&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 14:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/saving-the-label-from-PROC-in-ODS-OUTPUT/m-p/734282#M228768</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-15T14:01:44Z</dc:date>
    </item>
  </channel>
</rss>

