<?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 ODS Output PROC SURVEYFREQ VS SURVEYMEANS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ODS-Output-PROC-SURVEYFREQ-VS-SURVEYMEANS/m-p/928736#M365440</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using a macro, I am producing a series of crosstabs using several demographic variables (sex, age, income, etc.). Some of these variables have formats I created using PROC FORMAT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use PROC SURVEYFREQ, the ods output provides a table with a column that contains the values (say sex contains values 1 or 2) and another column with the formatted value (say F_sex contains Male or Female). I use the formatted columns and rename them Demographic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then append the files created with ods output and I obtain a column named Demographic that&amp;nbsp; contains the formatted values (ex. Male, Female, 18 to 30, 31 to 40, et.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I do the same with PROC SURVEYMEANS, the ods output does not include columns with formatted values only columns with the actual values such as 0 and 2 and not Male and Female).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to force ods output to include the formatted values?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;* Both PROC steps are part of a macro and &amp;amp;DemoVar contains the demographic variable ;
proc surveyfreq data=Mydataset	VARHEADER=LABEL	;

tables  year * &amp;amp;DemoVar * fg_use_choose
		year * &amp;amp;DemoVar * fg_use_amt
		year * &amp;amp;DemoVar * fg_use_assess
		year * &amp;amp;DemoVar * fg_use_plan
		year * &amp;amp;DemoVar * fg_use_wt
		year * &amp;amp;DemoVar * fg_use_away	/ nostd  row 	; 

weight  wght	;

format	income_adeq_G	income_adeq_G_F.
		fg_use_choose
		fg_use_amt
		fg_use_assess
		fg_use_plan
		fg_use_wt
		fg_use_away	yesno_F.	;

ods output CrossTabs=Results_Info	;

run	;

***********************************************;
proc surveymeans data=Mydataset	mean VARHEADER=LABEL	plots = none	;

var  FG_trust 	;

domain year * &amp;amp;DemoVar year	;

weight  wght	;

format	income_adeq_G	income_adeq_G_F.	;

ods output Domain=Results_Trust	;

run	;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Erik&lt;/P&gt;</description>
    <pubDate>Thu, 16 May 2024 20:14:37 GMT</pubDate>
    <dc:creator>icipeb</dc:creator>
    <dc:date>2024-05-16T20:14:37Z</dc:date>
    <item>
      <title>ODS Output PROC SURVEYFREQ VS SURVEYMEANS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ODS-Output-PROC-SURVEYFREQ-VS-SURVEYMEANS/m-p/928736#M365440</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using a macro, I am producing a series of crosstabs using several demographic variables (sex, age, income, etc.). Some of these variables have formats I created using PROC FORMAT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use PROC SURVEYFREQ, the ods output provides a table with a column that contains the values (say sex contains values 1 or 2) and another column with the formatted value (say F_sex contains Male or Female). I use the formatted columns and rename them Demographic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then append the files created with ods output and I obtain a column named Demographic that&amp;nbsp; contains the formatted values (ex. Male, Female, 18 to 30, 31 to 40, et.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I do the same with PROC SURVEYMEANS, the ods output does not include columns with formatted values only columns with the actual values such as 0 and 2 and not Male and Female).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to force ods output to include the formatted values?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;* Both PROC steps are part of a macro and &amp;amp;DemoVar contains the demographic variable ;
proc surveyfreq data=Mydataset	VARHEADER=LABEL	;

tables  year * &amp;amp;DemoVar * fg_use_choose
		year * &amp;amp;DemoVar * fg_use_amt
		year * &amp;amp;DemoVar * fg_use_assess
		year * &amp;amp;DemoVar * fg_use_plan
		year * &amp;amp;DemoVar * fg_use_wt
		year * &amp;amp;DemoVar * fg_use_away	/ nostd  row 	; 

weight  wght	;

format	income_adeq_G	income_adeq_G_F.
		fg_use_choose
		fg_use_amt
		fg_use_assess
		fg_use_plan
		fg_use_wt
		fg_use_away	yesno_F.	;

ods output CrossTabs=Results_Info	;

run	;

***********************************************;
proc surveymeans data=Mydataset	mean VARHEADER=LABEL	plots = none	;

var  FG_trust 	;

domain year * &amp;amp;DemoVar year	;

weight  wght	;

format	income_adeq_G	income_adeq_G_F.	;

ods output Domain=Results_Trust	;

run	;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Erik&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 20:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ODS-Output-PROC-SURVEYFREQ-VS-SURVEYMEANS/m-p/928736#M365440</guid>
      <dc:creator>icipeb</dc:creator>
      <dc:date>2024-05-16T20:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: ODS Output PROC SURVEYFREQ VS SURVEYMEANS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ODS-Output-PROC-SURVEYFREQ-VS-SURVEYMEANS/m-p/928758#M365448</link>
      <description>&lt;P&gt;As far as I can see you want to take the results from the Proc Surveymeans through a data step to add the new variable using the format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: you can save some coding by using the grouping syntax in the Tables statement.&lt;/P&gt;
&lt;P&gt;This should be equivalent yours:&lt;/P&gt;
&lt;PRE&gt;tables  (year * &amp;amp;DemoVar) * ( fg_use_choose
                              fg_use_amt
                              fg_use_assess
                              fg_use_plan
                              fg_use_wt
                              fg_use_away)	/ nostd  row 	; 
&lt;/PRE&gt;
&lt;P&gt;And in my code for my projects&lt;/P&gt;
&lt;PRE&gt;tables  year * ( &amp;lt;list of demovars&amp;gt;) * ( fg_use_choose
                              fg_use_amt
                              fg_use_assess
                              fg_use_plan
                              fg_use_wt
                              fg_use_away)	/ nostd  row 	; &lt;/PRE&gt;
&lt;P&gt;and only make one call to survey freq with those fg variables. That may be a style choice to avoid multiple data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 21:45:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ODS-Output-PROC-SURVEYFREQ-VS-SURVEYMEANS/m-p/928758#M365448</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-16T21:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: ODS Output PROC SURVEYFREQ VS SURVEYMEANS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ODS-Output-PROC-SURVEYFREQ-VS-SURVEYMEANS/m-p/928771#M365452</link>
      <description>&lt;P&gt;If I understand correctly, you need a data step and the VVALUE function and a RENAME.&amp;nbsp; This can be automated to some extent with a macro.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;  
   value $sex 'F'='Female' 'M'='Male';
   value age(multilabel) 11-12='Pre-teen' 13-16='Teen';
   quit;
proc surveymeans data=sashelp.class mean VARHEADER=LABEL	plots = none	;
   var  weight;
   domain age * sex age;
   *weight ;
   format sex $sex. age age.;
   ods output Domain=domain;
   run;

proc contents;
   run;
data domain;
   set domain;
   length f_age $10;
   f_age = vvalue(age);
   rename f_age=age age=n_age;
   run;
proc print;
   format _all_;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 422px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96594iB66BC2ABC024F2E7/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 22:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ODS-Output-PROC-SURVEYFREQ-VS-SURVEYMEANS/m-p/928771#M365452</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2024-05-16T22:11:07Z</dc:date>
    </item>
  </channel>
</rss>

