<?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 Question about iteration/nested loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79841#M17197</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG __jive_id="2982" alt="2013-01-18_161730.jpg" class="jive-image" src="https://communities.sas.com/legacyfs/online/2982_2013-01-18_161730.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am posting here because I am completely as a loss for how to accomplish the task I need to do under the scheme of SAS' programming structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem (with an example table which is similar to my working table above) is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have certain records with a recurring ID number, in this case 1-4 as seen above. Each record has a corresponding area. For each group of numbers 1-4, I would like to be able to divide the corresponding areas for&amp;nbsp; ID's 1-3 by the areas for ID 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like then to be able to either one of the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a. (The more roundabout option) Create a new field where for every instance of of ID4 the corresponding Area is assigned in the new field for the id's, making division easier:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AREA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NEW_FIELD&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 101.2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 324.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 234.9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492.8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 153.9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b. the more direct and preferred option would be to bypass the previous step and just create a field outright with the computation I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A modified version of what I have right now (which only addresses the step mentioned in part a) is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Work.Test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i = 1 to 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = 1 to 4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ID = 4 then result = Area;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate any insight that people may have to finding a solution to this problem. Unfortunately, as i mentioned, the SAS structure just isn't clicking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;earl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Jan 2013 22:34:48 GMT</pubDate>
    <dc:creator>emedina</dc:creator>
    <dc:date>2013-01-18T22:34:48Z</dc:date>
    <item>
      <title>Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79841#M17197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG __jive_id="2982" alt="2013-01-18_161730.jpg" class="jive-image" src="https://communities.sas.com/legacyfs/online/2982_2013-01-18_161730.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am posting here because I am completely as a loss for how to accomplish the task I need to do under the scheme of SAS' programming structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem (with an example table which is similar to my working table above) is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have certain records with a recurring ID number, in this case 1-4 as seen above. Each record has a corresponding area. For each group of numbers 1-4, I would like to be able to divide the corresponding areas for&amp;nbsp; ID's 1-3 by the areas for ID 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like then to be able to either one of the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a. (The more roundabout option) Create a new field where for every instance of of ID4 the corresponding Area is assigned in the new field for the id's, making division easier:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AREA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NEW_FIELD&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 101.2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 324.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 234.9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492.8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 153.9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b. the more direct and preferred option would be to bypass the previous step and just create a field outright with the computation I need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A modified version of what I have right now (which only addresses the step mentioned in part a) is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Test2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Work.Test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i = 1 to 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = 1 to 4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ID = 4 then result = Area;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate any insight that people may have to finding a solution to this problem. Unfortunately, as i mentioned, the SAS structure just isn't clicking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;earl&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jan 2013 22:34:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79841#M17197</guid>
      <dc:creator>emedina</dc:creator>
      <dc:date>2013-01-18T22:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79842#M17198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;data have;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;input ID AREA;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;datalines;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 101.2&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 324.5&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 234.9&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492.8 &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 153.9&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;data want;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;set have(where=(ID=4));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;div = area;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;do until(ID=4);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ratio = area / div;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;drop div;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;BR /&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;proc print; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Jan 2013 02:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79842#M17198</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-01-19T02:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79843#M17199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have written the following code in response to your post. hope this is what you are looking for. please let me know if this works for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input ID AREA;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 101.2&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 324.5&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 789.1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 234.9&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 492.8&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 153.9&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23.6&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%*-----------------------------------------------------------*;&lt;/P&gt;&lt;P&gt;%* to create a new_id to differentiate the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sets of 1-4*;&lt;/P&gt;&lt;P&gt;%*-----------------------------------------------------------*;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain new_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.id then new_id=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else new_id+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=want;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by new_id id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%*------------------------------------------*;&lt;/P&gt;&lt;P&gt;%* to get onlt the last id value *;&lt;/P&gt;&lt;P&gt;%*------------------------------------------*;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by new_id id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last.new_id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%*-------------------------------------------------------*;&lt;/P&gt;&lt;P&gt;%* to get the final dataset, also division &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; is also considered*;&lt;/P&gt;&lt;P&gt;%*------------------------------------------------------*;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data final(drop=new_id);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge want_(in=a rename=(area=new_field)) want(in=b);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by new_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last.new_id then new_field=.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; div=area/new_field;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%*------------------------------------------*;&lt;/P&gt;&lt;P&gt;%* The End *;&lt;/P&gt;&lt;P&gt;%*------------------------------------------*;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Jan 2013 11:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79843#M17199</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-01-19T11:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79844#M17200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much, PG. You have been immensely helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2013 00:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79844#M17200</guid>
      <dc:creator>emedina</dc:creator>
      <dc:date>2013-01-20T00:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79845#M17201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd like to thank you as well, Jagadish. It's always wonderful and useful to have/know more than one way of doing things!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2013 00:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79845#M17201</guid>
      <dc:creator>emedina</dc:creator>
      <dc:date>2013-01-20T00:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79846#M17202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just another question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say I only want to apply the division to records 1 and 2 and leave record 3 alone. How do I restrict the number of records the computation is applied to without messing up the loop?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2013 01:40:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79846#M17202</guid>
      <dc:creator>emedina</dc:creator>
      <dc:date>2013-01-20T01:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79847#M17203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Depends what you want exactly, you could do :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ID &amp;lt; 3 then ratio = area / div;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else call missing(ratio);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ratio = area / div;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ID &amp;lt; 3 then output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;In the first case you keep all records. In the second, you keep only records with a calculated ratio.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2013 03:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79847#M17203</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-01-20T03:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79848#M17204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very very helpful, PG! Forgive me, but there was in fact one more calculation I forgot:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say I wanted to divide a range of areas by another range of areas in a loop. That is, the ratio for&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Area 1/Area 10&lt;/P&gt;&lt;P&gt;Area 2/Area 11&lt;/P&gt;&lt;P&gt;Area 3/ Area 12&lt;/P&gt;&lt;P&gt;Area 4/Area 13&lt;/P&gt;&lt;P&gt;...stopping at Area 4 and repeating for those ranges.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, thank you PG. You've been immensely helpful. I'm starting to get the hang of the language and I've been successful in writing some related else if statements. My initial guess is that I'll have to modify the statement that assigns the value for Area to div? That is, something like:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif; background-color: #ffffff;"&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif; background-color: #ffffff;"&gt;set have(where=(10 &amp;lt;= ID4 &amp;lt;= 13));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif; background-color: #ffffff;"&gt;div = area;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif; background-color: #ffffff;"&gt;do until(ID=4);&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2013 22:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79848#M17204</guid>
      <dc:creator>emedina</dc:creator>
      <dc:date>2013-01-20T22:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79849#M17205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your data is VERY regular, i.e. there always exists an area10-area13 sequence for each area1-area4 sequence, you could use :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;data want;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;set have(where=(ID in (10,11,12,13)));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;div = area;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;divID = ID;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;set have(where=(ID in (1,2,3,4)));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;ratio = area / div;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;drop div;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: calibri, verdana, arial, sans-serif; font-size: 12pt;"&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 02:23:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79849#M17205</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-01-21T02:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Question about iteration/nested loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79850#M17206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the purpose of the "divID = ID" in the code, PG? The code works, but I'd like to be able to see all of my records (let's say say I have 20 repeating ids). Thank you so much for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 14:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-iteration-nested-loop/m-p/79850#M17206</guid>
      <dc:creator>emedina</dc:creator>
      <dc:date>2013-01-22T14:53:08Z</dc:date>
    </item>
  </channel>
</rss>

