<?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: Combine the results of proc means in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328814#M73464</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/106891"&gt;@yotsuba88&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I really appreciate your reply. I tried to follow the instruction to insert data but I need time to figure out step 2 and 3. So I insert the photos here to show my data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. First, I want to combine 2 tables (as photo 1), I think your code can solve it, but when I run it , there are errors:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Variable _STAT_ is not on file R.ID_MEAN.&lt;BR /&gt;ERROR: Variable _STAT_ is not on file R.JUMP_MEAN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you get an ERROR: Show the code with the error message from the log. Copy and paste into a code box in the forum using the {i} icon.&lt;/P&gt;
&lt;P&gt;Run proc contents on your data sets:&lt;/P&gt;
&lt;PRE&gt;proc contents data=R.id_mean;
run;&lt;/PRE&gt;
&lt;P&gt;Do you actually see a variable _stat_ in the results?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How does "Photo1: id or residual" relate to R.id_mean or R.Jump_mean? "Id or residual" is not a typical SAS data set name.&lt;/P&gt;
&lt;P&gt;Similar what relationship does "Photo 2: hi_lo" have to those two named data sets? And since the Photo 1 has a variable hi_lo did the lables to your photos get mixed up?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what would the result of the combination look like? When you combine a data set with one row with another consisting of multiple rows there a number of options that all depend on the desired result. Do you want the shown value of prob on each row or only the first?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And when you say you want prob like * you need to provide a rule and all of the possible values for assignment especially if you are using that ancient social science convention of * ** *** or **** to mean "more significant" which is wrong in so many ways.&lt;/P&gt;
&lt;P&gt;You can create a custom format to use with value ranges to display anything based on a range:&lt;/P&gt;
&lt;PRE&gt;Proc Format library=work;
value Myvalue
0    - .15 = 'small'
.15 &amp;lt;- .5  = 'middle'
.5  &amp;lt;- .99 = 'larger'
.99 &amp;lt;- high= 'largest'
;
run;&lt;/PRE&gt;
&lt;P&gt;And then for example in proc print add a statement of: Format prob myvalue. ; to display prob using the text for the given range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2017 16:58:17 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-01-31T16:58:17Z</dc:date>
    <item>
      <title>Combine the results of proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328358#M73316</link>
      <description>&lt;P&gt;&amp;nbsp;Hi guys,&lt;/P&gt;&lt;P&gt;I have datasets but I cannot figure out how to combine them into table for my study.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data 1: Id&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;_TYPE_&lt;/TD&gt;&lt;TD&gt;_FREQ_&lt;/TD&gt;&lt;TD&gt;_STAT_&lt;/TD&gt;&lt;TD&gt;lo&lt;/TD&gt;&lt;TD&gt;_1&lt;/TD&gt;&lt;TD&gt;_2&lt;/TD&gt;&lt;TD&gt;_3&lt;/TD&gt;&lt;TD&gt;_4&lt;/TD&gt;&lt;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D&gt;0.407785&lt;/TD&gt;&lt;TD&gt;0.369088&lt;/TD&gt;&lt;TD&gt;0.437692&lt;/TD&gt;&lt;TD&gt;0.45696&lt;/TD&gt;&lt;TD&gt;0.482542&lt;/TD&gt;&lt;TD&gt;0.465672&lt;/TD&gt;&lt;TD&gt;0.565849&lt;/TD&gt;&lt;TD&gt;0.191825&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1057&lt;/TD&gt;&lt;TD&gt;MEAN&lt;/TD&gt;&lt;TD&gt;0.005521&lt;/TD&gt;&lt;TD&gt;0.00818&lt;/TD&gt;&lt;TD&gt;0.009393&lt;/TD&gt;&lt;TD&gt;0.010307&lt;/TD&gt;&lt;TD&gt;0.01091&lt;/TD&gt;&lt;TD&gt;0.011886&lt;/TD&gt;&lt;TD&gt;0.012513&lt;/TD&gt;&lt;TD&gt;0.013377&lt;/TD&gt;&lt;TD&gt;0.014061&lt;/TD&gt;&lt;TD&gt;0.016413&lt;/TD&gt;&lt;TD&gt;0.010892&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1057&lt;/TD&gt;&lt;TD&gt;STD&lt;/TD&gt;&lt;TD&gt;0.062728&lt;/TD&gt;&lt;TD&gt;0.051646&lt;/TD&gt;&lt;TD&gt;0.047011&lt;/TD&gt;&lt;TD&gt;0.044721&lt;/TD&gt;&lt;TD&gt;0.042443&lt;/TD&gt;&lt;TD&gt;0.042108&lt;/TD&gt;&lt;TD&gt;0.043049&lt;/TD&gt;&lt;TD&gt;0.045113&lt;/TD&gt;&lt;TD&gt;0.047327&lt;/TD&gt;&lt;TD&gt;0.058048&lt;/TD&gt;&lt;TD&gt;0.032986&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Data 2 : residual (the same table but different data)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to keep MEAN and change it to ID or RESIDUAL in horizons. And keep columns lo _1 _2 _3...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please tell me how can I do it. Thank you so much.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 11:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328358#M73316</guid>
      <dc:creator>yotsuba88</dc:creator>
      <dc:date>2017-01-30T11:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the results of proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328359#M73317</link>
      <description>&lt;P&gt;Post your test data in the form of a datastep:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;And provide what you want the output to look like. &amp;nbsp;Your post is all messed up across the screen and can't see it.&lt;/P&gt;
&lt;P&gt;It sounds like a simple set:&lt;/P&gt;
&lt;PRE&gt;data want;
  set data1 (where=(_stat_="MEAN") keep=_1 _2 _3 in=a)
       data2 (where=(_stat_="MEAN") keep=_1 _2 _3 in=b);
  if a then _stat_="RESIDUAL";
  else _stat_="ID";
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Jan 2017 11:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328359#M73317</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-30T11:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the results of proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328387#M73325</link>
      <description>&lt;P&gt;Thank you so much, I will pay attention to fix my post now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How about if I want to insert t-value next to mean value by change it to * or **. ?&lt;/P&gt;&lt;P&gt;I tried to find and it seems I must use macro to run this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 13:10:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328387#M73325</guid>
      <dc:creator>yotsuba88</dc:creator>
      <dc:date>2017-01-30T13:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the results of proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328428#M73331</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post test data, in the form of a datastep and what you want out. &amp;nbsp;Your original post doesn't even show a t-test, but a similar process can work, just change the if's, and the where to include t-test.&lt;/P&gt;
&lt;P&gt;Also note: "&lt;SPAN&gt;I tried to find and it seems I must use macro to run this. "&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That statement is completely untrue. &amp;nbsp;Macro does&amp;nbsp;&lt;STRONG&gt;nothing&lt;/STRONG&gt; at all, it is just a code generator, it does nothing itself. &amp;nbsp;Your task is a very simple one, and one datastep should do it.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 14:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328428#M73331</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-30T14:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the results of proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328498#M73348</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I really appreciate your reply. I tried to follow the instruction to insert data but I need time to figure out step 2 and 3. So I insert the photos here to show my data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. First, I want to combine 2 tables (as photo 1), I think your code can solve it, but when I run it , there are errors:&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Variable _STAT_ is not on file R.ID_MEAN.&lt;BR /&gt;ERROR: Variable _STAT_ is not on file R.JUMP_MEAN.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Photo 1: Id or residual&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7014iD490D65F2BE627DE/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Id.PNG" title="Id.PNG" /&gt;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&amp;nbsp;I want to add tvalue and prob next to hi_lo column in photo 1 and show prob like *. &amp;nbsp;And I only found macro code for this, maybe I am wrong in searching codes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Photo 2: hi_lo,&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7015i8B23ED93A2F70884/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="idpama.PNG" title="idpama.PNG" /&gt;&lt;/P&gt;&lt;P&gt;I am a new one in SAS so sorry if my request is so stupid. Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 16:26:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328498#M73348</guid>
      <dc:creator>yotsuba88</dc:creator>
      <dc:date>2017-01-30T16:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the results of proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328554#M73360</link>
      <description>&lt;P&gt;And your latest input on the topic is further illustration of why a SAS data set is crucial in solving the problem.&amp;nbsp;&amp;nbsp; You show a picture of a data set with the variable _STAT_, and you show error messages from a sas log claiming _stat_ is not in the identified data sets.&amp;nbsp;&amp;nbsp; We would be in a far better position to help if the actual data, or a sample thereof were in the topic presentation.&amp;nbsp; At the very least show us the log in which the error message occured.&amp;nbsp; Either the vars aren't in the data sets, or your program has a component the eliminates access to those vars.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 19:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328554#M73360</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-01-30T19:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the results of proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328814#M73464</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/106891"&gt;@yotsuba88&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I really appreciate your reply. I tried to follow the instruction to insert data but I need time to figure out step 2 and 3. So I insert the photos here to show my data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. First, I want to combine 2 tables (as photo 1), I think your code can solve it, but when I run it , there are errors:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Variable _STAT_ is not on file R.ID_MEAN.&lt;BR /&gt;ERROR: Variable _STAT_ is not on file R.JUMP_MEAN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you get an ERROR: Show the code with the error message from the log. Copy and paste into a code box in the forum using the {i} icon.&lt;/P&gt;
&lt;P&gt;Run proc contents on your data sets:&lt;/P&gt;
&lt;PRE&gt;proc contents data=R.id_mean;
run;&lt;/PRE&gt;
&lt;P&gt;Do you actually see a variable _stat_ in the results?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How does "Photo1: id or residual" relate to R.id_mean or R.Jump_mean? "Id or residual" is not a typical SAS data set name.&lt;/P&gt;
&lt;P&gt;Similar what relationship does "Photo 2: hi_lo" have to those two named data sets? And since the Photo 1 has a variable hi_lo did the lables to your photos get mixed up?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what would the result of the combination look like? When you combine a data set with one row with another consisting of multiple rows there a number of options that all depend on the desired result. Do you want the shown value of prob on each row or only the first?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And when you say you want prob like * you need to provide a rule and all of the possible values for assignment especially if you are using that ancient social science convention of * ** *** or **** to mean "more significant" which is wrong in so many ways.&lt;/P&gt;
&lt;P&gt;You can create a custom format to use with value ranges to display anything based on a range:&lt;/P&gt;
&lt;PRE&gt;Proc Format library=work;
value Myvalue
0    - .15 = 'small'
.15 &amp;lt;- .5  = 'middle'
.5  &amp;lt;- .99 = 'larger'
.99 &amp;lt;- high= 'largest'
;
run;&lt;/PRE&gt;
&lt;P&gt;And then for example in proc print add a statement of: Format prob myvalue. ; to display prob using the text for the given range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 16:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/328814#M73464</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-31T16:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the results of proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/329273#M73644</link>
      <description>Thank you so much. I am learning to post sample in the forum. Anw, I can solve the problem a bit, except the combine tvalue and prob.</description>
      <pubDate>Thu, 02 Feb 2017 02:46:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/329273#M73644</guid>
      <dc:creator>yotsuba88</dc:creator>
      <dc:date>2017-02-02T02:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Combine the results of proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/329275#M73646</link>
      <description>Thank you so much for your detail explanation. Sorry but I dont understand the meaning of prob like *, I need to check again.&lt;BR /&gt;&lt;BR /&gt;Photo 1, I mean there are 2 tables like pho 1 (id and residual), and I want to merge 2 tables in one.&lt;BR /&gt;Photo 2, the estimate is "hi_lo", and I want to merge tvalue and prob next to hi_lo into photo 1.&lt;BR /&gt;Anw, I can solve the problem in the table 1, but not for adding tvalue and prob next to hi_lo.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Feb 2017 02:53:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-the-results-of-proc-means/m-p/329275#M73646</guid>
      <dc:creator>yotsuba88</dc:creator>
      <dc:date>2017-02-02T02:53:30Z</dc:date>
    </item>
  </channel>
</rss>

