<?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 Generate Chart using Proc Gchart similar to one with Proc Freq. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Generate-Chart-using-Proc-Gchart-similar-to-one-with-Proc-Freq/m-p/774232#M246047</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see the code below:&lt;/P&gt;&lt;P&gt;In the below code I create two charts. One using Proc Freq and other using Proc GChart.&lt;/P&gt;&lt;P&gt;I want a chart that is generated by Proc Freq, but by using Proc GChart.&lt;/P&gt;&lt;P&gt;I have put necessary titles in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise!&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input variable1 yyyymm;
informat yyyymm yymmn6.;
format yyyymm yymmn6.;
datalines;
. 202101
. 202101
0 202101
0 202101
0 202101
0 202102
0 202102
. 202102
0 202102
1 202102
0 202103
0 202103
0 202103
0 202103
0 202103
0 202104
0 202104
0 202104
1 202104
0 202104
0 202105
0 202105
0 202105
1 202105
1 202105
0 202106
. 202106
. 202106
. 202106
1 202106
;run;


proc format ;
value  nmissfmt
	.="Missing"
	;
run;

ods graphics on;
proc freq data=have;
Title "Want the below chart using Proc GChart";
format variable1 nmissfmt.;
tables variable1*yyyymm /  missing norow nocol nopercent out=freq_output 
plots=freqplot(twoway=stacked orient=Horizontal );
run;
title "";
data freq_output2(rename=(t=variable1));
	set freq_output(rename=( variable1 = _tempvar_));
	format t nmissfmt.;
	t=_tempvar_;
	drop _tempvar_;
run;
title "";
proc gchart data=freq_output2;
Title "This is what I get using GChart. I want the chart to look like from Proc Freq up Above.";
format variable1 nmissfmt.;
hbar variable1 / 	group=yyyymm
				subgroup=variable1
				sumvar=count
;
run;
quit;
title "";&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 14 Oct 2021 14:12:12 GMT</pubDate>
    <dc:creator>david27</dc:creator>
    <dc:date>2021-10-14T14:12:12Z</dc:date>
    <item>
      <title>Generate Chart using Proc Gchart similar to one with Proc Freq.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-Chart-using-Proc-Gchart-similar-to-one-with-Proc-Freq/m-p/774232#M246047</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see the code below:&lt;/P&gt;&lt;P&gt;In the below code I create two charts. One using Proc Freq and other using Proc GChart.&lt;/P&gt;&lt;P&gt;I want a chart that is generated by Proc Freq, but by using Proc GChart.&lt;/P&gt;&lt;P&gt;I have put necessary titles in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise!&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input variable1 yyyymm;
informat yyyymm yymmn6.;
format yyyymm yymmn6.;
datalines;
. 202101
. 202101
0 202101
0 202101
0 202101
0 202102
0 202102
. 202102
0 202102
1 202102
0 202103
0 202103
0 202103
0 202103
0 202103
0 202104
0 202104
0 202104
1 202104
0 202104
0 202105
0 202105
0 202105
1 202105
1 202105
0 202106
. 202106
. 202106
. 202106
1 202106
;run;


proc format ;
value  nmissfmt
	.="Missing"
	;
run;

ods graphics on;
proc freq data=have;
Title "Want the below chart using Proc GChart";
format variable1 nmissfmt.;
tables variable1*yyyymm /  missing norow nocol nopercent out=freq_output 
plots=freqplot(twoway=stacked orient=Horizontal );
run;
title "";
data freq_output2(rename=(t=variable1));
	set freq_output(rename=( variable1 = _tempvar_));
	format t nmissfmt.;
	t=_tempvar_;
	drop _tempvar_;
run;
title "";
proc gchart data=freq_output2;
Title "This is what I get using GChart. I want the chart to look like from Proc Freq up Above.";
format variable1 nmissfmt.;
hbar variable1 / 	group=yyyymm
				subgroup=variable1
				sumvar=count
;
run;
quit;
title "";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Oct 2021 14:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-Chart-using-Proc-Gchart-similar-to-one-with-Proc-Freq/m-p/774232#M246047</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2021-10-14T14:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Chart using Proc Gchart similar to one with Proc Freq.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-Chart-using-Proc-Gchart-similar-to-one-with-Proc-Freq/m-p/774249#M246056</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=have;
hbar yyyymm / group=variable1 stat=freq missing;
format variable1 nmissfmt.;
label variable1 ='Variable1';
yaxis reverse;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;For further customization see:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n0p7vdd69sgf3wn1479qxqxuryrt.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n0p7vdd69sgf3wn1479qxqxuryrt.htm&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/215179"&gt;@david27&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see the code below:&lt;/P&gt;
&lt;P&gt;In the below code I create two charts. One using Proc Freq and other using Proc GChart.&lt;/P&gt;
&lt;P&gt;I want a chart that is generated by Proc Freq, but by using Proc GChart.&lt;/P&gt;
&lt;P&gt;I have put necessary titles in the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please advise!&lt;/P&gt;
&lt;P&gt;Thank You&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input variable1 yyyymm;
informat yyyymm yymmn6.;
format yyyymm yymmn6.;
datalines;
. 202101
. 202101
0 202101
0 202101
0 202101
0 202102
0 202102
. 202102
0 202102
1 202102
0 202103
0 202103
0 202103
0 202103
0 202103
0 202104
0 202104
0 202104
1 202104
0 202104
0 202105
0 202105
0 202105
1 202105
1 202105
0 202106
. 202106
. 202106
. 202106
1 202106
;run;


proc format ;
value  nmissfmt
	.="Missing"
	;
run;

ods graphics on;
proc freq data=have;
Title "Want the below chart using Proc GChart";
format variable1 nmissfmt.;
tables variable1*yyyymm /  missing norow nocol nopercent out=freq_output 
plots=freqplot(twoway=stacked orient=Horizontal );
run;
title "";
data freq_output2(rename=(t=variable1));
	set freq_output(rename=( variable1 = _tempvar_));
	format t nmissfmt.;
	t=_tempvar_;
	drop _tempvar_;
run;
title "";
proc gchart data=freq_output2;
Title "This is what I get using GChart. I want the chart to look like from Proc Freq up Above.";
format variable1 nmissfmt.;
hbar variable1 / 	group=yyyymm
				subgroup=variable1
				sumvar=count
;
run;
quit;
title "";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 15:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-Chart-using-Proc-Gchart-similar-to-one-with-Proc-Freq/m-p/774249#M246056</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-14T15:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Generate Chart using Proc Gchart similar to one with Proc Freq.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-Chart-using-Proc-Gchart-similar-to-one-with-Proc-Freq/m-p/774253#M246058</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;: Thank You very much for the solution. I &lt;STRONG&gt;accidentally &lt;/STRONG&gt;selected my reply as solution. How do i correct it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You for teaching me that i dont have to do frequency first to create the chart. I can get it from raw table itself !!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 15:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-Chart-using-Proc-Gchart-similar-to-one-with-Proc-Freq/m-p/774253#M246058</guid>
      <dc:creator>david27</dc:creator>
      <dc:date>2021-10-14T15:24:07Z</dc:date>
    </item>
  </channel>
</rss>

