<?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 Proc Transpose data after using Proc Tabulate for descriptive statistics in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Proc-Transpose-data-after-using-Proc-Tabulate-for-descriptive/m-p/785886#M32175</link>
    <description>&lt;P&gt;I am creating a table for 4 variables : Dem_Incomebelowpoverty, Dem_pctn_AfricanAmerican, Out_County_obesity, and Risk_pct_yes. Here is part of the data, there are a total of 64 observations.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zaichik17_0-1639425353001.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66716iD5D4555A95D76BD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Zaichik17_0-1639425353001.png" alt="Zaichik17_0-1639425353001.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to have these 4 variables and then the Mean +/- SD as one column and Median as the second column,&lt;/P&gt;&lt;P&gt;so after Proc Tabulate it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods output Table=SummaryTable1_pre;&lt;/P&gt;&lt;P&gt;PROC TABULATE DATA = CoAnl.combined_analysis MISSING;&lt;BR /&gt;VAR Dem_IncomeBelowPoverty Dem_Pctn_Africanamerican Out_County_obesity Risk_pct_yes ;&lt;BR /&gt;TABLE Dem_IncomeBelowPoverty Dem_Pctn_Africanamerican Out_County_obesity Risk_pct_yes, mean*f=percent7.1 std*f=percent7.1 median*f=percent7.1/nocellmerge;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;This is the result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zaichik17_0-1639428421752.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66718i1F5738036AF2A9CD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Zaichik17_0-1639428421752.png" alt="Zaichik17_0-1639428421752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Next I need to combine Mean and Std to show as Mean +/- SD, so I'm using a data step and need to use proc transpose as this creates wide data, however I can't figure out how to keep Median in there? I want the final table to look like above but with Mean and Std combined.&lt;/P&gt;&lt;P&gt;DATA SummaryTable_pre2;&lt;BR /&gt;SET SummaryTable1_pre;&lt;BR /&gt;Dem_IncomeBelowPoverty=STRIP(PUT(Dem_IncomeBelowPoverty_Mean,8.2))||"^{Unicode 00B1}"||STRIP(PUT(Dem_IncomeBelowPoverty_Std,8.2));&lt;BR /&gt;Dem_Pctn_Africanamerican=STRIP(PUT(Dem_Pctn_Africanamerican_Mean,8.2))||"^{Unicode 00B1}"||STRIP(PUT(Dem_Pctn_Africanamerican_Std,8.2));&lt;BR /&gt;Out_County_obesity=STRIP(PUT(Out_County_obesity_Mean,8.2))||"^{Unicode 00B1}"||STRIP(PUT(Out_County_obesity_Std,8.2));&lt;BR /&gt;Risk_pct_yes=STRIP(PUT(Risk_pct_yes_Mean,8.2))||"^{Unicode 00B1}"||STRIP(PUT(Risk_pct_yes_Std,8.2));&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After I combined Mean and std to have a plus/minus sign, I used proc transpose:&lt;/P&gt;&lt;P&gt;PROC TRANSPOSE&lt;BR /&gt;DATA=SummaryTable1_pre2&lt;BR /&gt;OUT=SummaryTable_clean (RENAME=(_NAME_= Variable Col1=MeanSD));&lt;BR /&gt;VAR Dem_IncomeBelowPoverty Dem_Pctn_Africanamerican Out_County_obesity Risk_pct_yes Dem_Pctn_Africanamerican_Median Dem_IncomeBelowPoverty_Median Out_County_obesity_Median Risk_pct_yes_Median ;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure what to do to the&amp;nbsp;Dem_Pctn_Africanamerican_Median Dem_IncomeBelowPoverty_Median Out_County_obesity_Median Risk_pct_yes_Median variables to make a variable named Median and make it transposed onto the 4 variables I want to keep.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zaichik17_0-1639429206431.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66720iAE5A45882FBBA55A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Zaichik17_0-1639429206431.png" alt="Zaichik17_0-1639429206431.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 13 Dec 2021 21:00:34 GMT</pubDate>
    <dc:creator>Zaichik17</dc:creator>
    <dc:date>2021-12-13T21:00:34Z</dc:date>
    <item>
      <title>Proc Transpose data after using Proc Tabulate for descriptive statistics</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Transpose-data-after-using-Proc-Tabulate-for-descriptive/m-p/785886#M32175</link>
      <description>&lt;P&gt;I am creating a table for 4 variables : Dem_Incomebelowpoverty, Dem_pctn_AfricanAmerican, Out_County_obesity, and Risk_pct_yes. Here is part of the data, there are a total of 64 observations.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zaichik17_0-1639425353001.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66716iD5D4555A95D76BD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Zaichik17_0-1639425353001.png" alt="Zaichik17_0-1639425353001.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to have these 4 variables and then the Mean +/- SD as one column and Median as the second column,&lt;/P&gt;&lt;P&gt;so after Proc Tabulate it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods output Table=SummaryTable1_pre;&lt;/P&gt;&lt;P&gt;PROC TABULATE DATA = CoAnl.combined_analysis MISSING;&lt;BR /&gt;VAR Dem_IncomeBelowPoverty Dem_Pctn_Africanamerican Out_County_obesity Risk_pct_yes ;&lt;BR /&gt;TABLE Dem_IncomeBelowPoverty Dem_Pctn_Africanamerican Out_County_obesity Risk_pct_yes, mean*f=percent7.1 std*f=percent7.1 median*f=percent7.1/nocellmerge;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;This is the result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zaichik17_0-1639428421752.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66718i1F5738036AF2A9CD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Zaichik17_0-1639428421752.png" alt="Zaichik17_0-1639428421752.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Next I need to combine Mean and Std to show as Mean +/- SD, so I'm using a data step and need to use proc transpose as this creates wide data, however I can't figure out how to keep Median in there? I want the final table to look like above but with Mean and Std combined.&lt;/P&gt;&lt;P&gt;DATA SummaryTable_pre2;&lt;BR /&gt;SET SummaryTable1_pre;&lt;BR /&gt;Dem_IncomeBelowPoverty=STRIP(PUT(Dem_IncomeBelowPoverty_Mean,8.2))||"^{Unicode 00B1}"||STRIP(PUT(Dem_IncomeBelowPoverty_Std,8.2));&lt;BR /&gt;Dem_Pctn_Africanamerican=STRIP(PUT(Dem_Pctn_Africanamerican_Mean,8.2))||"^{Unicode 00B1}"||STRIP(PUT(Dem_Pctn_Africanamerican_Std,8.2));&lt;BR /&gt;Out_County_obesity=STRIP(PUT(Out_County_obesity_Mean,8.2))||"^{Unicode 00B1}"||STRIP(PUT(Out_County_obesity_Std,8.2));&lt;BR /&gt;Risk_pct_yes=STRIP(PUT(Risk_pct_yes_Mean,8.2))||"^{Unicode 00B1}"||STRIP(PUT(Risk_pct_yes_Std,8.2));&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After I combined Mean and std to have a plus/minus sign, I used proc transpose:&lt;/P&gt;&lt;P&gt;PROC TRANSPOSE&lt;BR /&gt;DATA=SummaryTable1_pre2&lt;BR /&gt;OUT=SummaryTable_clean (RENAME=(_NAME_= Variable Col1=MeanSD));&lt;BR /&gt;VAR Dem_IncomeBelowPoverty Dem_Pctn_Africanamerican Out_County_obesity Risk_pct_yes Dem_Pctn_Africanamerican_Median Dem_IncomeBelowPoverty_Median Out_County_obesity_Median Risk_pct_yes_Median ;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure what to do to the&amp;nbsp;Dem_Pctn_Africanamerican_Median Dem_IncomeBelowPoverty_Median Out_County_obesity_Median Risk_pct_yes_Median variables to make a variable named Median and make it transposed onto the 4 variables I want to keep.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zaichik17_0-1639429206431.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66720iAE5A45882FBBA55A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Zaichik17_0-1639429206431.png" alt="Zaichik17_0-1639429206431.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 21:00:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Transpose-data-after-using-Proc-Tabulate-for-descriptive/m-p/785886#M32175</guid>
      <dc:creator>Zaichik17</dc:creator>
      <dc:date>2021-12-13T21:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose data after using Proc Tabulate for descriptive statistics</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Transpose-data-after-using-Proc-Tabulate-for-descriptive/m-p/785894#M32176</link>
      <description>Instead of PROC TABULATE to calculate the statistics, I would suggest using PROC MEANS as you can control the output better and avoid the transpose step. &lt;BR /&gt;</description>
      <pubDate>Mon, 13 Dec 2021 22:04:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Transpose-data-after-using-Proc-Tabulate-for-descriptive/m-p/785894#M32176</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-13T22:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Transpose data after using Proc Tabulate for descriptive statistics</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Transpose-data-after-using-Proc-Tabulate-for-descriptive/m-p/785897#M32177</link>
      <description>&lt;P&gt;First thing about dealing with percentages: If your samples for each percentage are not the exact same then "mean" of a percentage is a misnomer at best and an outright lie at worst. Consider if a percentage of 15% is based on a population of 10,000 (1500/10000) and a second percentage of 13% is based on a population of 100 (13/100) when you average 15 and 13 you get 14. But the true percentage of the two groups combined is (1500 +13)/(10000+100) = 14.9802 %(rounded to 4 decimal places.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may be better off with the data before you calculated means to get some of those summaries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 22:15:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Transpose-data-after-using-Proc-Tabulate-for-descriptive/m-p/785897#M32177</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-12-13T22:15:46Z</dc:date>
    </item>
  </channel>
</rss>

