<?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: is there a way to print both the variable values AND the value labels in a frequency tabel? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537163#M147677</link>
    <description>&lt;P&gt;While you might need to do a little juggling, here is a way that is less complex and involves little&amp;nbsp; juggling.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the same of discussion, let's say the variable AGE has a format AGECAT. that translates it into the formatted labels.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Begin by creating a data set holding the percents:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=have;&lt;/P&gt;
&lt;P&gt;tables age / noprint out=age_counts (keep=age percent)&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The table doesn't print, but you can easily use the output data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set age_counts;&lt;/P&gt;
&lt;P&gt;category = age;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This creates a second variable with the same value.&amp;nbsp; But when printing, one gets formatted and one doesn't:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=want;&lt;/P&gt;
&lt;P&gt;var category age percent;&lt;/P&gt;
&lt;P&gt;format category;&lt;/P&gt;
&lt;P&gt;format age agecat.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Feb 2019 19:31:30 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-02-20T19:31:30Z</dc:date>
    <item>
      <title>is there a way to print both the variable values AND the value labels in a frequency tabel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537129#M147666</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to to print both the variable values AND the value labels in a frequency tabel?&lt;/P&gt;&lt;P&gt;When I use proc freq, at the moment only the value labels are displayed:&lt;/P&gt;&lt;P&gt;Age&lt;/P&gt;&lt;P&gt;up to 16 years:&amp;nbsp;12 %&lt;/P&gt;&lt;P&gt;17 to 30 years:&amp;nbsp;14 %&lt;/P&gt;&lt;P&gt;30 to 50 years:&amp;nbsp;36 %&lt;/P&gt;&lt;P&gt;50 to 65 years:&amp;nbsp;19 %&lt;/P&gt;&lt;P&gt;65 years and older: 18 %&lt;/P&gt;&lt;P&gt;missing: 18 %&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have defined them for my numeric variable Age&amp;nbsp;with proc format and pplied them in a data step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I cinfigure the system options, so that the output table looks like this:&lt;/P&gt;&lt;P&gt;1: up to 16 years:&amp;nbsp;12 %&lt;/P&gt;&lt;P&gt;2: 17 to 30 years:&amp;nbsp;14 %&lt;/P&gt;&lt;P&gt;3: 30 to 50 years:&amp;nbsp;36 %&lt;/P&gt;&lt;P&gt;4: 50 to 65 years:&amp;nbsp;19 %&lt;/P&gt;&lt;P&gt;5: 65 years and older: 18 %&lt;/P&gt;&lt;P&gt;9: missing: 1 %&lt;/P&gt;&lt;P&gt;(displaying both values and Labels)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any help.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 17:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537129#M147666</guid>
      <dc:creator>sylvanaw</dc:creator>
      <dc:date>2019-02-20T17:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to print both the variable values AND the value labels in a frequency tabel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537133#M147667</link>
      <description>Any particular reason? To force a sort order? If so, there are other ways &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 20 Feb 2019 17:30:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537133#M147667</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-20T17:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to print both the variable values AND the value labels in a frequency tabel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537137#M147668</link>
      <description>&lt;P&gt;He Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;No, I would rather like to check if all values and labels are assigned correctly as stated in the questionnaire and see if the frequencies of each category behave normal at the same time (in other words checking the correctness and plausibility of the data). &lt;/FONT&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Age is one of 181 variables that I would like&amp;nbsp;to check.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;So I&amp;nbsp;would&amp;nbsp;like to&amp;nbsp;know&amp;nbsp;how to change what is displayed in&amp;nbsp;all the frequency tables by default if that exists.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 17:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537137#M147668</guid>
      <dc:creator>sylvanaw</dc:creator>
      <dc:date>2019-02-20T17:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to print both the variable values AND the value labels in a frequency tabel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537138#M147669</link>
      <description>&lt;P&gt;Ah, well in that case I don't think there's an easy way to check that. You can check the formats definitions if you wanted fairly easily, but it wouldn't have the counts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/263051"&gt;@sylvanaw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;He Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;No, I would rather like to check if all values and labels are assigned correctly as stated in the questionnaire and see if the frequencies of each category behave normal at the same time (in other words checking the correctness and plausibility of the data). &lt;/FONT&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;Age is one of 181 variables that I would like&amp;nbsp;to check.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;So I&amp;nbsp;would&amp;nbsp;like to&amp;nbsp;know&amp;nbsp;how to change what is displayed in&amp;nbsp;all the frequency tables by default if that exists.&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 17:43:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537138#M147669</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-20T17:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to print both the variable values AND the value labels in a frequency tabel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537140#M147670</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/263051"&gt;@sylvanaw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;He Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;No, I would rather like to check if all values and labels are assigned correctly as stated in the questionnaire and see if the frequencies of each category behave normal at the same time (in other words checking the correctness and plausibility of the data). &lt;/FONT&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;Age is one of 181 variables that I would like&amp;nbsp;to check.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Calibri" size="3" color="#000000"&gt;So I&amp;nbsp;would&amp;nbsp;like to&amp;nbsp;know&amp;nbsp;how to change what is displayed in&amp;nbsp;all the frequency tables by default if that exists.&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Frequency tables is not the way to check this. PROC CONTENTS will provide the variable name and associated label.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 17:51:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537140#M147670</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-02-20T17:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to print both the variable values AND the value labels in a frequency tabel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537151#M147675</link>
      <description>&lt;P&gt;I am not&amp;nbsp;looking not for the variable lables, but for the value labels for each category (see example above).&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 18:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537151#M147675</guid>
      <dc:creator>sylvanaw</dc:creator>
      <dc:date>2019-02-20T18:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to print both the variable values AND the value labels in a frequency tabel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537158#M147676</link>
      <description>&lt;P&gt;Fancy things can be done with proc template. I have found some papers, but non explaining how to show formatted and unformatted values. Search-string used: "site:sas.com proc template freq".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could clone the formats and add the value to the text displayed and use those formats in proc freq. &lt;/P&gt;
&lt;P&gt;An example using sashelp.class:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
	value $Gender
		'M' = 'Male'
		'F' = 'Female'
	;
run;


proc freq data=sashelp.class;
	format Sex $Gender.;
	table Sex;
run;


proc format cntlout=work.GenderFmt;
	select $Gender;
run;


data work.GenderFmt;
	set work.GenderFmt(rename=(label = oldLabel));
	
	length Label $ 10;
	drop oldLabel length default;
	format Label;
	
	Label = cats(Start, ':', oldLabel);
	FmtName = cats(FmtName, '_Clone'); /* will cause trouble with long format names */

run;

proc format cntlin=work.GenderFmt;
run;

proc freq data=sashelp.class;
	format Sex $Gender_Clone.;
	table Sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 19:11:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537158#M147676</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-02-20T19:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to print both the variable values AND the value labels in a frequency tabel?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537163#M147677</link>
      <description>&lt;P&gt;While you might need to do a little juggling, here is a way that is less complex and involves little&amp;nbsp; juggling.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the same of discussion, let's say the variable AGE has a format AGECAT. that translates it into the formatted labels.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Begin by creating a data set holding the percents:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=have;&lt;/P&gt;
&lt;P&gt;tables age / noprint out=age_counts (keep=age percent)&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The table doesn't print, but you can easily use the output data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set age_counts;&lt;/P&gt;
&lt;P&gt;category = age;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This creates a second variable with the same value.&amp;nbsp; But when printing, one gets formatted and one doesn't:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=want;&lt;/P&gt;
&lt;P&gt;var category age percent;&lt;/P&gt;
&lt;P&gt;format category;&lt;/P&gt;
&lt;P&gt;format age agecat.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 19:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/is-there-a-way-to-print-both-the-variable-values-AND-the-value/m-p/537163#M147677</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-20T19:31:30Z</dc:date>
    </item>
  </channel>
</rss>

