<?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: Transpose the n, mean median along with dosage. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745588#M233743</link>
    <description>data final;&lt;BR /&gt;input segment_code 2. armcode 2. N $2. mean $4. median $4.;&lt;BR /&gt;;&lt;BR /&gt;cards;&lt;BR /&gt;1 1	3 1.00 1.00&lt;BR /&gt;2 1	5 2.00 2.00&lt;BR /&gt;3 1	4 3.00 3.00&lt;BR /&gt;1 2	0 0.00 0.00&lt;BR /&gt;2 2	0 0.00 0.00&lt;BR /&gt;3 2	0 0.00 0.00&lt;BR /&gt;1 3	0 0.00 0.00&lt;BR /&gt;2 3	0 0.00 0.00&lt;BR /&gt;3 3	0 0.00 0.00&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;I am looking for a rtf output file report. Please let me know if you need any additional information.</description>
    <pubDate>Thu, 03 Jun 2021 19:12:49 GMT</pubDate>
    <dc:creator>RAVI2000</dc:creator>
    <dc:date>2021-06-03T19:12:49Z</dc:date>
    <item>
      <title>Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745553#M233719</link>
      <description>&lt;P&gt;I have my proc means output like below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S_RAVI_0-1622741261868.png" style="width: 547px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59997iB28A75493EC8F110/image-dimensions/547x211?v=v2" width="547" height="211" role="button" title="S_RAVI_0-1622741261868.png" alt="S_RAVI_0-1622741261868.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want the final output data set to be like below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S_RAVI_1-1622741495265.png" style="width: 553px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59998i9F67F7DEE54F6F92/image-dimensions/553x125?v=v2" width="553" height="125" role="button" title="S_RAVI_1-1622741495265.png" alt="S_RAVI_1-1622741495265.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when I proc transpose&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data = fin out = fin_t(drop = _name_) prefix = col;
	by armcode segment_code;
    var N mean median;
    id armcode;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is giving me like below&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S_RAVI_2-1622741680213.png" style="width: 499px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59999iF6F3E5669AFAE6F2/image-dimensions/499x601?v=v2" width="499" height="601" role="button" title="S_RAVI_2-1622741680213.png" alt="S_RAVI_2-1622741680213.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;col1, col2, col3 are the armcodes. How do I get the n, mean, median as column headings?&lt;/P&gt;
&lt;P&gt;I want the vertical n, mean, median to be horizontal for every armcode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please correct me. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 17:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745553#M233719</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-06-03T17:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745561#M233722</link>
      <description>&lt;P&gt;Do you want a report that can be printed or e-mailed or used in a presentation? Or do you want a dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want a report, then PROC REPORT will do this relatively easily, and if you provide a portion of your SAS data set as data step code (as explained &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;here&lt;/A&gt;), I can provide actual code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want a data set, then do not (I repeat in bold capital letters, &lt;STRONG&gt;DO NOT&lt;/STRONG&gt;) transpose the data this way, this only makes working with the data harder in almost every situation. Further explanation about what you are doing and what the end goal is would be needed.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 17:54:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745561#M233722</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-03T17:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745567#M233726</link>
      <description>I think you should be using PROC TABULATE entirely here instead from scratch or look at the different output methods of PROC MEANS.</description>
      <pubDate>Thu, 03 Jun 2021 18:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745567#M233726</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-03T18:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745588#M233743</link>
      <description>data final;&lt;BR /&gt;input segment_code 2. armcode 2. N $2. mean $4. median $4.;&lt;BR /&gt;;&lt;BR /&gt;cards;&lt;BR /&gt;1 1	3 1.00 1.00&lt;BR /&gt;2 1	5 2.00 2.00&lt;BR /&gt;3 1	4 3.00 3.00&lt;BR /&gt;1 2	0 0.00 0.00&lt;BR /&gt;2 2	0 0.00 0.00&lt;BR /&gt;3 2	0 0.00 0.00&lt;BR /&gt;1 3	0 0.00 0.00&lt;BR /&gt;2 3	0 0.00 0.00&lt;BR /&gt;3 3	0 0.00 0.00&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;I am looking for a rtf output file report. Please let me know if you need any additional information.</description>
      <pubDate>Thu, 03 Jun 2021 19:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745588#M233743</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-06-03T19:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745592#M233746</link>
      <description>I'm suggesting you back up further. How did you create this data set, show that code? PROC TABULATE will generate it automatically in that format but PROC REPORT would be used to display summarized information.</description>
      <pubDate>Thu, 03 Jun 2021 19:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745592#M233746</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-03T19:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745597#M233749</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data final;
input segment_code armcode N mean median;
cards;
1 1 3 1.00 1.00
2 1 5 2.00 2.00
3 1 4 3.00 3.00
1 2 0 0.00 0.00
2 2 0 0.00 0.00
3 2 0 0.00 0.00
1 3 0 0.00 0.00
2 3 0 0.00 0.00
3 3 0 0.00 0.00
;
run;

proc report data=final;
    columns ("Assessment" segment_code) ("Dose Level" armcode,(n mean median));
    define segment_code/group "Segment Code";
    define armcode/across "Arm Code";
    define n/analysis sum;
    define mean/analysis sum;
    define median/analysis sum;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Jun 2021 19:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745597#M233749</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-03T19:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745612#M233758</link>
      <description>Since my N, mean, median are character I am getting the below error.&lt;BR /&gt;ERROR: n is an ANALYSIS variable but not numeric.&lt;BR /&gt;ERROR: mean is an ANALYSIS variable but not numeric.&lt;BR /&gt;ERROR: median is an ANALYSIS variable but not numeric.</description>
      <pubDate>Thu, 03 Jun 2021 20:17:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745612#M233758</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-06-03T20:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745613#M233759</link>
      <description>I had missing values in my data so I converted the N, MEAN, MEDIAN into character and assigned as "0", "0.00", "0.00".</description>
      <pubDate>Thu, 03 Jun 2021 20:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745613#M233759</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-06-03T20:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745614#M233760</link>
      <description>Change the word ANALYSIS to DISPLAY.</description>
      <pubDate>Thu, 03 Jun 2021 20:22:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745614#M233760</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-03T20:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745617#M233763</link>
      <description>&lt;P&gt;430 proc report data = fin;&lt;BR /&gt;431 columns ("Assessment" segment_code) ("Dose Level" armcode,(N mean&lt;BR /&gt;431 ! median));&lt;BR /&gt;432 define segment_code/group "Segment Code";&lt;BR /&gt;433 define armcode/across "Arm Code";&lt;BR /&gt;434 define N/display;&lt;BR /&gt;435 define mean/display;&lt;BR /&gt;436 define median/display;&lt;BR /&gt;437 run;&lt;BR /&gt;&lt;BR /&gt;ERROR: There is no statistic associated with N.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 20:28:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745617#M233763</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-06-03T20:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745619#M233765</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I had missing values in my data so I converted the N, MEAN, MEDIAN into character and assigned as "0", "0.00", "0.00".&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To quote Bill the Cat: "Gaaack!".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FORMATS are the way too control appearance in SAS output, not creating new variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally showing 0.00 for either a mean or median is a lie. You are claiming that the mean or median is 0 when in fact it does not exist.&lt;/P&gt;
&lt;P&gt;0 for N is fine as that is an accurate count.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc format;&lt;/P&gt;
&lt;P&gt;value misszero&lt;/P&gt;
&lt;P&gt;. = '0'&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;and use the MISSZERO. format for the numeric variable in the report display code. The default shown will use a BEST type format for any other value. Or you could explicitly set a different format for other values such as&lt;/P&gt;
&lt;P&gt;Proc format;&lt;/P&gt;
&lt;P&gt;value misszero&lt;/P&gt;
&lt;P&gt;. = '0'&lt;/P&gt;
&lt;P&gt;other= [Comma6.]&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;which would display non-missing values with the comma6. format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A different format for the mean and/or median could show missing as something like 'N/A' for not available if you must have something.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 20:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745619#M233765</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-03T20:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745621#M233766</link>
      <description>I quite accept you!</description>
      <pubDate>Thu, 03 Jun 2021 20:53:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745621#M233766</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-06-03T20:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose the n, mean median along with dosage.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745623#M233767</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Since my N, mean, median are character I am getting the below error.&lt;BR /&gt;ERROR: n is an ANALYSIS variable but not numeric.&lt;BR /&gt;ERROR: mean is an ANALYSIS variable but not numeric.&lt;BR /&gt;ERROR: median is an ANALYSIS variable but not numeric.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Always ALWAYS &lt;STRONG&gt;ALWAYS&lt;/STRONG&gt; a mistake to make numbers such as mean, median and n into character variables. Don't make your coding more difficult by doing things like this. As stated by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; , formats control the appearance.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 21:04:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-the-n-mean-median-along-with-dosage/m-p/745623#M233767</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-03T21:04:36Z</dc:date>
    </item>
  </channel>
</rss>

