<?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 Sas Programming 3: Advanced Techniques - Lesson 3, practice 5 in Advanced Programming</title>
    <link>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866500#M223</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have compared my solution to the solution shown for lesson 3, practice 5, but I only get a single row of output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;data is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;pg3.storm_maxwindseasqtr&lt;/LI&gt;&lt;LI&gt;pg3.storm_stats&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Output line from my attempt:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlexEt_al_2021_1-1679913976371.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82089iA73C42B8BC698087/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlexEt_al_2021_1-1679913976371.png" alt="AlexEt_al_2021_1-1679913976371.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have used ChatGPT to assess whether the solution and my solution is doing the same thing, and it seems to be doing the exact same thing, so I don't know where i'm going wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried to use their keywords in the do-loops, but that has not solved&lt;BR /&gt;&lt;BR /&gt;My Solution:&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;data work.MaxWind;
    array MWTable[1980:2016,4] _temporary_;  
    if _N_=1 then do S=1980 to 2016;
       set pg3.storm_maxwindseasqtr;
       array MWQ[4] MaxWindQ1-MaxWindQ4;
       do Q=1 to 4;
          MWTable[S,Q]=MWQ[Q];
       end;
    end;
    set pg3.storm_stats;
    Qtr=qtr(StartDate);
    MaxWindSQ=MWTable[Season,Qtr];
    Difference=MaxWindMPH-MaxWindSQ;
    &lt;STRONG&gt;drop S Q MaxWindQ1-MaxWindQ4;&lt;/STRONG&gt;
run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;The guided solution is the following:&lt;BR /&gt;&lt;BR /&gt;data work.MaxWind;
    array MWTable[1980:2016,4] _temporary_;  
    if _N_=1 then do S=1980 to 2016;
       set pg3.storm_maxwindseasqtr;
       array MWQ[4] MaxWindQ1-MaxWindQ4;
       do Q=1 to 4;
          MWTable[S,Q]=MWQ[Q];
       end;
    end;
    set pg3.storm_stats;
    Qtr=qtr(StartDate);
    MaxWindSQ=MWTable[Season,Qtr];
    Difference=MaxWindMPH-MaxWindSQ;
    &lt;STRONG&gt;drop S Q MaxWindQ1-MaxWindQ4;&lt;/STRONG&gt;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2023 10:52:30 GMT</pubDate>
    <dc:creator>AlexEt_al_2021</dc:creator>
    <dc:date>2023-03-27T10:52:30Z</dc:date>
    <item>
      <title>Sas Programming 3: Advanced Techniques - Lesson 3, practice 5</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866500#M223</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have compared my solution to the solution shown for lesson 3, practice 5, but I only get a single row of output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;data is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;pg3.storm_maxwindseasqtr&lt;/LI&gt;&lt;LI&gt;pg3.storm_stats&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Output line from my attempt:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlexEt_al_2021_1-1679913976371.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82089iA73C42B8BC698087/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlexEt_al_2021_1-1679913976371.png" alt="AlexEt_al_2021_1-1679913976371.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have used ChatGPT to assess whether the solution and my solution is doing the same thing, and it seems to be doing the exact same thing, so I don't know where i'm going wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried to use their keywords in the do-loops, but that has not solved&lt;BR /&gt;&lt;BR /&gt;My Solution:&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;data work.MaxWind;
    array MWTable[1980:2016,4] _temporary_;  
    if _N_=1 then do S=1980 to 2016;
       set pg3.storm_maxwindseasqtr;
       array MWQ[4] MaxWindQ1-MaxWindQ4;
       do Q=1 to 4;
          MWTable[S,Q]=MWQ[Q];
       end;
    end;
    set pg3.storm_stats;
    Qtr=qtr(StartDate);
    MaxWindSQ=MWTable[Season,Qtr];
    Difference=MaxWindMPH-MaxWindSQ;
    &lt;STRONG&gt;drop S Q MaxWindQ1-MaxWindQ4;&lt;/STRONG&gt;
run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;The guided solution is the following:&lt;BR /&gt;&lt;BR /&gt;data work.MaxWind;
    array MWTable[1980:2016,4] _temporary_;  
    if _N_=1 then do S=1980 to 2016;
       set pg3.storm_maxwindseasqtr;
       array MWQ[4] MaxWindQ1-MaxWindQ4;
       do Q=1 to 4;
          MWTable[S,Q]=MWQ[Q];
       end;
    end;
    set pg3.storm_stats;
    Qtr=qtr(StartDate);
    MaxWindSQ=MWTable[Season,Qtr];
    Difference=MaxWindMPH-MaxWindSQ;
    &lt;STRONG&gt;drop S Q MaxWindQ1-MaxWindQ4;&lt;/STRONG&gt;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 10:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866500#M223</guid>
      <dc:creator>AlexEt_al_2021</dc:creator>
      <dc:date>2023-03-27T10:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Programming 3: Advanced Techniques - Lesson 3, practice 5</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866505#M224</link>
      <description>I fail to see the difference between the two code snippets.&lt;BR /&gt;Did you paste the wrong code?</description>
      <pubDate>Mon, 27 Mar 2023 11:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866505#M224</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-03-27T11:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Programming 3: Advanced Techniques - Lesson 3, practice 5</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866506#M225</link>
      <description>Yep... **bleep**, sorry about that.&lt;BR /&gt;&lt;BR /&gt;Here is my solution.&lt;BR /&gt;&lt;BR /&gt;data work.MaxWind;&lt;BR /&gt;/* add code to create and load two-dimensional array */&lt;BR /&gt;array MWTable[1980:2016,4] _temporary_;&lt;BR /&gt;&lt;BR /&gt;if _N_ then do Yr = 1980 to 2016;&lt;BR /&gt;set pg3.storm_maxwindseasqtr;&lt;BR /&gt;array MWQ[4] MaxWindQ1-MaxWindQ4;&lt;BR /&gt;do Q = 1 to 4;&lt;BR /&gt;MWTable[Yr, Q] = MWQ[Q];&lt;BR /&gt;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;set pg3.storm_stats;&lt;BR /&gt;Qtr=qtr(StartDate);&lt;BR /&gt;/* add code to use two-dimensional array */&lt;BR /&gt;MaxWindSQ = MWTable[Season, Qtr];&lt;BR /&gt;Difference = MaxWindMPH - MaxWindSQ;&lt;BR /&gt;drop Yr Q MaxWindQ1-MaxWindQ4;&lt;BR /&gt;run;</description>
      <pubDate>Mon, 27 Mar 2023 11:20:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866506#M225</guid>
      <dc:creator>AlexEt_al_2021</dc:creator>
      <dc:date>2023-03-27T11:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Programming 3: Advanced Techniques - Lesson 3, practice 5</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866509#M226</link>
      <description>&lt;P&gt;I think you need to add _N_ &lt;STRONG&gt;= 1&lt;/STRONG&gt;, otherwise the IF statement will be true for every iteration of the data step.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 11:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866509#M226</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-03-27T11:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sas Programming 3: Advanced Techniques - Lesson 3, practice 5</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866510#M227</link>
      <description>That's it!! That worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Weird how ChatGPT said the two pieces of code achieved the same thing.</description>
      <pubDate>Mon, 27 Mar 2023 11:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/Sas-Programming-3-Advanced-Techniques-Lesson-3-practice-5/m-p/866510#M227</guid>
      <dc:creator>AlexEt_al_2021</dc:creator>
      <dc:date>2023-03-27T11:27:49Z</dc:date>
    </item>
  </channel>
</rss>

