<?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: Need help to write   macro to ttest 100 cells in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561422#M157163</link>
    <description>How can you test one value against a series of values - you could test if the mean of all the other values was equal to a specific value, but I'm guessing I don't understand your data structure.  I really thing you need to provide sample data here-make some basic fake data in Excel and show a few of the calculations needed to illustrate your problem.&lt;BR /&gt;</description>
    <pubDate>Fri, 24 May 2019 14:53:19 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-05-24T14:53:19Z</dc:date>
    <item>
      <title>Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561276#M157100</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am new to SAS&amp;nbsp; macros and I am literally awful at doing it !&lt;/P&gt;&lt;P&gt;I have 100 random digits 00-99 and want to t-test their interaction&amp;nbsp; with SAS.&lt;/P&gt;&lt;P&gt;For example test cell 00 with 1-99 other cells,test cell 1 with 00 and 2-99 cells.&lt;/P&gt;&lt;P&gt;Is there a way to write a macro that will do this ?&lt;/P&gt;&lt;P&gt;So&amp;nbsp; say i=00-99 and j=00-99;&lt;/P&gt;&lt;P&gt;run the test if i=00 with j which is between 1 and 99 .if i=j then do not test so do not test same cells .&lt;/P&gt;&lt;P&gt;Is there an easy way to do this ?&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Ivy&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 01:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561276#M157100</guid>
      <dc:creator>ivyc</dc:creator>
      <dc:date>2019-05-24T01:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561284#M157105</link>
      <description>If you can show how the code would work for a single case we can likely help make it into a macro - or suggest code that would do the test without a macro. It would also help if you explained your data structure. Feel free to use data in the SASHELP library or generate random data using RAND() functions.</description>
      <pubDate>Fri, 24 May 2019 02:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561284#M157105</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-24T02:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561290#M157108</link>
      <description>So I have 100 random digits that have values 00 to 99.&lt;BR /&gt;I want to test their interaction using ttest(i am OK with writing SQL code).&lt;BR /&gt;So I am testing random digit 00 with random digit 1,then 00 with random digit 2,etc all the way to testing 00 and 99.&lt;BR /&gt;Then I want to test random digit 1 with 00,1 with 2,1 with 3,1 with 4 ,etc all the way 1 to 99.and all the way up to testing 99 digit with 00,99 with 1,99 with 2 etc.&lt;BR /&gt;I need to come up with the macro that will run this many iterations.&lt;BR /&gt;Can you help me with that?&lt;BR /&gt;</description>
      <pubDate>Fri, 24 May 2019 02:47:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561290#M157108</guid>
      <dc:creator>ivyc</dc:creator>
      <dc:date>2019-05-24T02:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561292#M157109</link>
      <description>&lt;P&gt;If you provide the base case (sample data and code for t-test) I'm happy to help turn this into a macro. Otherwise I'm sure someone else will be along.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/255030"&gt;@ivyc&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;So I have 100 random digits that have values 00 to 99.&lt;BR /&gt;I want to test their interaction using ttest(i am OK with writing SQL code).&lt;BR /&gt;So I am testing random digit 00 with random digit 1,then 00 with random digit 2,etc all the way to testing 00 and 99.&lt;BR /&gt;Then I want to test random digit 1 with 00,1 with 2,1 with 3,1 with 4 ,etc all the way 1 to 99.and all the way up to testing 99 digit with 00,99 with 1,99 with 2 etc.&lt;BR /&gt;I need to come up with the macro that will run this many iterations.&lt;BR /&gt;Can you help me with that?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 02:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561292#M157109</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-24T02:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561380#M157144</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;said, show us code with no macros that works on one instance of doing this t-test, and the we can help turn this into a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, it is not clear how a t-test applies to this case of 100 random digits, it is unclear what response variable is used in the t-test, it is unclear what hypothesis is being tested.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 13:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561380#M157144</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-24T13:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561410#M157158</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/255030"&gt;@ivyc&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;So I have 100 random digits that have values 00 to 99.&lt;BR /&gt;I want to test their interaction using ttest(i am OK with writing SQL code).&lt;BR /&gt;So I am testing random digit 00 with random digit 1,then 00 with random digit 2,etc all the way to testing 00 and 99.&lt;BR /&gt;Then I want to test random digit 1 with 00,1 with 2,1 with 3,1 with 4 ,etc all the way 1 to 99.and all the way up to testing 99 digit with 00,99 with 1,99 with 2 etc.&lt;BR /&gt;I need to come up with the macro that will run this many iterations.&lt;BR /&gt;Can you help me with that?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Actual example data might help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &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; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Terminology: '00' is not a digit. 0 1 2 3 4 5&amp;nbsp; 6 7 8 9&amp;nbsp;&amp;nbsp;are digits and for most purposes digits are character. So ttest involving means would be meaningless.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What comparison of "random digit 1 with 00'? Actual values and the type of comparison are critical&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that you may mean that have VARIABLES possibly in some order that you want to compare .&lt;/P&gt;
&lt;P&gt;If you are looking for some kind of paired comparison where the question is about the differences between variables per record then the TTEST option Paired may be what you want and it supports list processing such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PAIRED (V1 - V10) * (Y1 - Y100);&lt;/P&gt;
&lt;P&gt;which would do&amp;nbsp;paired tests with each variable from &amp;nbsp;V1 to V10&amp;nbsp;paired with each variable from&amp;nbsp;Y1 to Y100.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 14:31:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561410#M157158</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-24T14:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561419#M157162</link>
      <description>This is the code :&lt;BR /&gt;&lt;BR /&gt;%macro runit(no);&lt;BR /&gt;&lt;BR /&gt;title 'BeaconScr';&lt;BR /&gt;proc ttest data=stacked2 cochran ci=equal umpu ;&lt;BR /&gt;class cell_ind;&lt;BR /&gt;var beacon_scr; /*** change this ****/&lt;BR /&gt;where beacon_scr&amp;gt;350 and cell_ind in ("CELL&amp;amp;no.","CELL&amp;amp;mo") ; /*** change this ***/&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%macro repull;&lt;BR /&gt;%do i = 00 %to 99;&lt;BR /&gt;%let I = &amp;amp;i;&lt;BR /&gt;%runit(&amp;amp;i);&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;%repull;&lt;BR /&gt;I need to write macro to define cell&amp;amp;mo.So if cell&amp;amp;no has value of lets say 2 ,I am testing it against allother 99 values of Cell&amp;amp;mo.So cell&amp;amp;mo. has all values other than 2.To me that is a tricky part to define in macros.Thanks</description>
      <pubDate>Fri, 24 May 2019 14:45:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561419#M157162</guid>
      <dc:creator>ivyc</dc:creator>
      <dc:date>2019-05-24T14:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561422#M157163</link>
      <description>How can you test one value against a series of values - you could test if the mean of all the other values was equal to a specific value, but I'm guessing I don't understand your data structure.  I really thing you need to provide sample data here-make some basic fake data in Excel and show a few of the calculations needed to illustrate your problem.&lt;BR /&gt;</description>
      <pubDate>Fri, 24 May 2019 14:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561422#M157163</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-24T14:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561441#M157167</link>
      <description>&lt;P&gt;Show us a portion of your actual SAS data set stacked2,&amp;nbsp;&lt;STRONG&gt;following these instructions:&lt;/STRONG&gt;&amp;nbsp;&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;</description>
      <pubDate>Fri, 24 May 2019 15:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561441#M157167</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-05-24T15:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need help to write   macro to ttest 100 cells</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561495#M157203</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/255030"&gt;@ivyc&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;This is the code :&lt;BR /&gt;&lt;BR /&gt;%macro runit(no);&lt;BR /&gt;&lt;BR /&gt;title 'BeaconScr';&lt;BR /&gt;proc ttest data=stacked2 cochran ci=equal umpu ;&lt;BR /&gt;class cell_ind;&lt;BR /&gt;var beacon_scr; /*** change this ****/&lt;BR /&gt;where beacon_scr&amp;gt;350 and cell_ind in ("CELL&amp;amp;no.","CELL&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;&amp;amp;mo&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;") ; /*** change this ***/&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%macro repull;&lt;BR /&gt;%do i = 00 %to 99;&lt;BR /&gt;%let I = &amp;amp;i;&lt;BR /&gt;%runit(&amp;amp;i);&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;%repull;&lt;BR /&gt;I need to write macro to define cell&amp;amp;mo.So if cell&amp;amp;no has value of lets say 2 ,I am testing it against allother 99 values of Cell&amp;amp;mo.So cell&amp;amp;mo. has all values other than 2.To me that is a tricky part to define in macros.Thanks&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think that you may need to provide to us at least the explicit values you need. The value of &amp;amp;I you are attempting to use is not what I think you need. Consider:&lt;/P&gt;
&lt;PRE&gt;%macro dummy;
%do i = 00 %to 10;
%put i is &amp;amp;i.;
%end;
%mend;
%dummy&lt;/PRE&gt;
&lt;P&gt;Examine the log to see the values. The value of &amp;amp;I is &lt;STRONG&gt;not 00&lt;/STRONG&gt;, it is 0. And if you were expecting to generate something like 01 02 etc then you need to show us because the code you have now is not doing it.&lt;/P&gt;
&lt;P&gt;Instead of hiding things with macro code, show the EXACT Proc ttest code you need to generate for a few values of &amp;amp;no, &amp;amp;mo. No macro variables anywhere. Complete Proc Ttest code from Proc statement to Run statement.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 17:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-help-to-write-macro-to-ttest-100-cells/m-p/561495#M157203</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-24T17:44:35Z</dc:date>
    </item>
  </channel>
</rss>

