<?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 Best option to transpose proc freq data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Best-option-to-transpose-proc-freq-data/m-p/199536#M266707</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For tables I ve produced using proc SQL, I'd like to add a row of frequencies at the top of the table.&amp;nbsp; Do you have suggestions for the best way for me to add this row to the table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a better way than to: use proc freq, then use data step processing to create a data set with just the row of frequencies I want (since, for example, proc transpose wouldn't seem to be helpful since the proc freq output data set wouldn't be multiple observations per ID/by variable)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Current Proc SQL table:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 576px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="35" width="64"&gt;Obs&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;Variable&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;estabgroupamp&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;estabgroupsst&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;estabgroupnur&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;estabgrouphih&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;F&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;PROB&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;pooledmean&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;" width="64"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;var1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;" width="64"&gt;2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;var2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;" width="64"&gt;3&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;var3&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to add a row of frequencies for estabgroupamp through estabgrouphih&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;So, used the following:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data=sample;&lt;/P&gt;&lt;P&gt;table estabgroup /out=freq_estabgroup;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data freq_estabgroup1;&lt;/P&gt;&lt;P&gt;set freq_estabgroup;&lt;/P&gt;&lt;P&gt;variable="N";&lt;/P&gt;&lt;P&gt;if estabgroup="amp" then N_estabgroup_amp=COUNT;&lt;/P&gt;&lt;P&gt;if estabgroup="sst" then N_estabgroup_sst=COUNT;&lt;/P&gt;&lt;P&gt;if estabgroup="hih" then N_estabgroup_hih=COUNT;&lt;/P&gt;&lt;P&gt;if estabgroup="nur" then N_estabgroup_nur=COUNT;&lt;/P&gt;&lt;P&gt;drop estabgroup count percent;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;But of course I get:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="10100" alt="" class="jiveImage" src="https://communities.sas.com/legacyfs/online/10100_pastedImage_6.png" style="width: 739px; height: 132px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a better way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 19 Apr 2015 23:22:41 GMT</pubDate>
    <dc:creator>Maisha_Huq</dc:creator>
    <dc:date>2015-04-19T23:22:41Z</dc:date>
    <item>
      <title>Best option to transpose proc freq data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-option-to-transpose-proc-freq-data/m-p/199536#M266707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For tables I ve produced using proc SQL, I'd like to add a row of frequencies at the top of the table.&amp;nbsp; Do you have suggestions for the best way for me to add this row to the table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a better way than to: use proc freq, then use data step processing to create a data set with just the row of frequencies I want (since, for example, proc transpose wouldn't seem to be helpful since the proc freq output data set wouldn't be multiple observations per ID/by variable)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;Current Proc SQL table:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 576px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="35" width="64"&gt;Obs&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;Variable&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;estabgroupamp&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;estabgroupsst&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;estabgroupnur&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;estabgrouphih&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;F&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;PROB&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;pooledmean&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;" width="64"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;var1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;" width="64"&gt;2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;var2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="20" style="border-top: none;" width="64"&gt;3&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;var3&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="64"&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to add a row of frequencies for estabgroupamp through estabgrouphih&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;So, used the following:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data=sample;&lt;/P&gt;&lt;P&gt;table estabgroup /out=freq_estabgroup;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data freq_estabgroup1;&lt;/P&gt;&lt;P&gt;set freq_estabgroup;&lt;/P&gt;&lt;P&gt;variable="N";&lt;/P&gt;&lt;P&gt;if estabgroup="amp" then N_estabgroup_amp=COUNT;&lt;/P&gt;&lt;P&gt;if estabgroup="sst" then N_estabgroup_sst=COUNT;&lt;/P&gt;&lt;P&gt;if estabgroup="hih" then N_estabgroup_hih=COUNT;&lt;/P&gt;&lt;P&gt;if estabgroup="nur" then N_estabgroup_nur=COUNT;&lt;/P&gt;&lt;P&gt;drop estabgroup count percent;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;But of course I get:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="10100" alt="" class="jiveImage" src="https://communities.sas.com/legacyfs/online/10100_pastedImage_6.png" style="width: 739px; height: 132px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a better way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Apr 2015 23:22:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-option-to-transpose-proc-freq-data/m-p/199536#M266707</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2015-04-19T23:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: Best option to transpose proc freq data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-option-to-transpose-proc-freq-data/m-p/199537#M266708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You didn't show what your table looked like prior to running proc freq but, given your proc freq output, you could always use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*create test data*/&lt;/P&gt;&lt;P&gt;data &lt;SPAN style="font-size: 13.3333330154419px;"&gt;freq_estabgroup&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input variable $&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; N_exemplar_Control&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; N_exemplar_CurrentOSHA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; N_exemplar_Dialogue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; N_exemplar_Furture&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; N_exemplar_MythFact;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;N 64608 . . . .&lt;/P&gt;&lt;P&gt;N . 6802 . . .&lt;/P&gt;&lt;P&gt;N . . 6802 . .&lt;/P&gt;&lt;P&gt;N . . . 10285 .&lt;/P&gt;&lt;P&gt;N . . . . 10207&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data &lt;SPAN style="font-size: 13.3333330154419px;"&gt;freq_estabgroup1&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; update&amp;nbsp; freq_estabgroup (obs=1)&amp;nbsp; freq_estabgroup;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by variable;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Apr 2015 23:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-option-to-transpose-proc-freq-data/m-p/199537#M266708</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-04-19T23:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Best option to transpose proc freq data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-option-to-transpose-proc-freq-data/m-p/199538#M266709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;Maisha_Huq wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Is there a better way than to: use proc freq, then use data step processing to create a data set with just the row of frequencies I want (since, for example, proc transpose wouldn't seem to be helpful since the proc freq output data set wouldn't be multiple observations per ID/by variable)?&lt;/P&gt;
&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you try a proc transpose? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 00:22:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-option-to-transpose-proc-freq-data/m-p/199538#M266709</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-20T00:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Best option to transpose proc freq data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Best-option-to-transpose-proc-freq-data/m-p/199539#M266710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both!&amp;nbsp; I ended up going with some data step processing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 16:54:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Best-option-to-transpose-proc-freq-data/m-p/199539#M266710</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2015-04-20T16:54:56Z</dc:date>
    </item>
  </channel>
</rss>

