<?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: Can compare within a stage, need to compare between stages in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-compare-within-a-stage-need-to-compare-between-stages/m-p/874014#M345276</link>
    <description>&lt;P&gt;First, I don't really understand the experiment. BUT if you have 3 different outcome measure variables like S1, S2 and S3 that you think should be treated then perhaps you want to reshape the data so that you have a variable to indicate the stage and a single "measure" value.&lt;/P&gt;
&lt;P&gt;So if your current data looks like&lt;/P&gt;
&lt;P&gt;Mouse line S1 S2 S3&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&amp;nbsp; 14&amp;nbsp; 14.5&amp;nbsp; (obviously very made up numbers)&lt;/P&gt;
&lt;P&gt;Then reshape to&lt;/P&gt;
&lt;P&gt;Mouse Line Stage Measure&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14.5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which would be a task for Proc transpose something like:&lt;/P&gt;
&lt;PRE&gt;Proc transpose data=have out=trans
       prefix=measure;
     by mouse line;
     var s1 s2 s3;
run;&lt;/PRE&gt;
&lt;P&gt;The behavior of simple transpose code would add a variable _name_ with the value S1 S2 S3, the name of the original variable. Options would allow renaming it to Stage to make more sense.&lt;/P&gt;
&lt;P&gt;Obviously your data and code would also include your Treat variable (and possibly others).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then&lt;/P&gt;
&lt;P&gt;1) change the data set name to the transposed set&lt;/P&gt;
&lt;P&gt;2) add Stage (or _name_ or whatever) to the Class statement.&lt;/P&gt;
&lt;P&gt;3) change the model statement to use Measure (or which name you get in the transposed data) as the dependent and add Stage (or whatever) to the independent side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LSMEANS, Estimate and Contrast statements let you build "questions" about combinations of the variables in the model.&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2023 21:36:23 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-05-04T21:36:23Z</dc:date>
    <item>
      <title>Can compare within a stage, need to compare between stages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-compare-within-a-stage-need-to-compare-between-stages/m-p/874007#M345272</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;Hello, I have a programming problem that has me stumped, and it's a bit embarrassing because in theory it seems so simple. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;I have a data set of mouse activity in a behavior test. There are multiple types of mice, that received one of four combinations of treatments. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;I've been able to compare the mice according to their type and treatment with code like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;proc sort; by treat;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;proc glm; by treat;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;class line;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;model s1-s3 = line / nouni;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;repeated s;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;means line / tukey;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;means line;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;run;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;In this example, I can compare my mouse strains ("line") within each treatment condition &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;("treat"), &lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;in each stage of a 3-stage test ("s1-s3"). For example, I could say that mouse line B spent more time in some particular zone than mouse line A in stage 2. &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;This is all well and good, but I would also like to be able to compare between stages. In other words, I need to see if there are any significant changes in performance from stage 1 to stage 2 to stage 3 within each line and/or treatment condition.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;For example, did mouse line A show a significant difference in time spent in some particular zone between stage 1 and 2? What about between stage 2 and 3? These are the questions I need to answer. I've exhausted my creativity trying to rewrite my code to generate these stage comparisons, but it's a nut I can't seem to crack.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;SPAN class=""&gt;If anyone could offer some insight or some useful resources, it be very helpful! &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 21:04:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-compare-within-a-stage-need-to-compare-between-stages/m-p/874007#M345272</guid>
      <dc:creator>itvanflein</dc:creator>
      <dc:date>2023-05-04T21:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can compare within a stage, need to compare between stages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-compare-within-a-stage-need-to-compare-between-stages/m-p/874014#M345276</link>
      <description>&lt;P&gt;First, I don't really understand the experiment. BUT if you have 3 different outcome measure variables like S1, S2 and S3 that you think should be treated then perhaps you want to reshape the data so that you have a variable to indicate the stage and a single "measure" value.&lt;/P&gt;
&lt;P&gt;So if your current data looks like&lt;/P&gt;
&lt;P&gt;Mouse line S1 S2 S3&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&amp;nbsp; 14&amp;nbsp; 14.5&amp;nbsp; (obviously very made up numbers)&lt;/P&gt;
&lt;P&gt;Then reshape to&lt;/P&gt;
&lt;P&gt;Mouse Line Stage Measure&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&lt;/P&gt;
&lt;P&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; S3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14.5&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which would be a task for Proc transpose something like:&lt;/P&gt;
&lt;PRE&gt;Proc transpose data=have out=trans
       prefix=measure;
     by mouse line;
     var s1 s2 s3;
run;&lt;/PRE&gt;
&lt;P&gt;The behavior of simple transpose code would add a variable _name_ with the value S1 S2 S3, the name of the original variable. Options would allow renaming it to Stage to make more sense.&lt;/P&gt;
&lt;P&gt;Obviously your data and code would also include your Treat variable (and possibly others).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then&lt;/P&gt;
&lt;P&gt;1) change the data set name to the transposed set&lt;/P&gt;
&lt;P&gt;2) add Stage (or _name_ or whatever) to the Class statement.&lt;/P&gt;
&lt;P&gt;3) change the model statement to use Measure (or which name you get in the transposed data) as the dependent and add Stage (or whatever) to the independent side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LSMEANS, Estimate and Contrast statements let you build "questions" about combinations of the variables in the model.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 21:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-compare-within-a-stage-need-to-compare-between-stages/m-p/874014#M345276</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-05-04T21:36:23Z</dc:date>
    </item>
  </channel>
</rss>

