<?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: Nested do loop in sas in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139622#M37347</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ... some other ideas ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just make all x values 0 to start and just change the p=s x values to 1 ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;array _x{9,9}&amp;nbsp; x1-x81 (81*0);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;do i=1 to 9;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;do j=1 to 9;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; if p&lt;I&gt; = s&lt;J&gt; then _x[i,j] = 1;&lt;/J&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt;&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;or get rid if the IF ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;array _x{9,9}&amp;nbsp; x1-x81;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do i=1 to 9;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do j=1 to 9;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; _x(i,j) = p(i) eq s(j);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jun 2014 13:26:11 GMT</pubDate>
    <dc:creator>MikeZdeb</dc:creator>
    <dc:date>2014-06-12T13:26:11Z</dc:date>
    <item>
      <title>Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139619#M37344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is what i need to do on my dataset:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have list of variables: p1-p9 and s1-s9. I want to create variables x1-x81 (9*9).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;based on if p1=1 and s1=1 then x1=1; else x1 =0;&lt;/P&gt;&lt;P&gt;so on for all p1=1 with s1-s9 and so on for each p1-p9.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to do this in sas. The manual if else takes so much time. I tried to use nested do loop by using 2 loops 1 for p1-p9 and another for s1-s9. but not working . I think array method will work.&lt;/P&gt;&lt;P&gt;But not sure how to let the nested loop use array of x1-x81.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggestions plz?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 10:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139619#M37344</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2014-06-12T10:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139620#M37345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why wouldn't an array work? Have you tried?&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;z=1;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1 to 9;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt; do j=1 to 9;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt; if p&lt;I&gt; = s&lt;J&gt; then x&lt;Z&gt; = 1; &lt;/Z&gt;&lt;/J&gt;&lt;/I&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt; else x&lt;Z&gt; = 0;&lt;/Z&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt; z+1;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt; end;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 11:15:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139620#M37345</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-06-12T11:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139621#M37346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or use two dimension array.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array _x{9,9}&amp;nbsp; x1-x81 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;do i=1 to 9;&lt;/P&gt;&lt;TABLE style="border: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;do j=1 to 9;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;if p&lt;I&gt; = s&lt;J&gt; then x[i,j] = 1;&lt;/J&gt;&lt;/I&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;else &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; x[i,j] &lt;/SPAN&gt;= 0;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;end;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Xia Keshan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 12:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139621#M37346</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-06-12T12:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139622#M37347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ... some other ideas ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;just make all x values 0 to start and just change the p=s x values to 1 ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;array _x{9,9}&amp;nbsp; x1-x81 (81*0);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;do i=1 to 9;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;do j=1 to 9;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; if p&lt;I&gt; = s&lt;J&gt; then _x[i,j] = 1;&lt;/J&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt;&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;or get rid if the IF ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;array _x{9,9}&amp;nbsp; x1-x81;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do i=1 to 9;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do j=1 to 9;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; _x(i,j) = p(i) eq s(j);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 13:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139622#M37347</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2014-06-12T13:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139623#M37348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So long , Mike !&lt;/P&gt;&lt;P&gt;When are you going to China ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 13:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139623#M37348</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-06-12T13:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139624#M37349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are the other values of p1/s1. If it's only 1 and 0's you can multiply instead of if/condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that may be faster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;array _x{9,9}&amp;nbsp; x1-x81;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do i=1 to 9;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do j=1 to 9;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; _x(i,j) = p(i) * s(j);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 14:36:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139624#M37349</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-12T14:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139625#M37350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The condition was if p1=1 and s1=1, they may take other values for which i wanted 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I tried unsuccessfully:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;array p det_lyrica_p1-det_lyrica_p7;&lt;/P&gt;&lt;P&gt;array s det_lyrica_s1-det_lyrica_s7;&lt;/P&gt;&lt;P&gt;array x det_lyrica_p8-det_lyrica_p56;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;z=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1 to 7;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j=1 to 7;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if p&lt;I&gt; =1 and&amp;nbsp; s&lt;J&gt;=1 then x&lt;Z&gt; = 1;&lt;/Z&gt;&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else x&lt;Z&gt; = 0;&lt;/Z&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z+1;&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;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it gave just 1 obs and made all p&lt;I&gt; and s&lt;J&gt; as . or missing and put all x&lt;Z&gt;=0. I need the variables x&lt;Z&gt; to be created for each obs level value.&lt;/Z&gt;&lt;/Z&gt;&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 14:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139625#M37350</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2014-06-12T14:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139626#M37351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have an existing data set with data for the P and S variables?&amp;nbsp; If so, there is nothing in your program that brings in that existing data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you want the program to create a separate observation for every possible combination of the P and S variables?&amp;nbsp; If so, you might have to tell us what values the variables are allowed to take.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 15:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139626#M37351</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-06-12T15:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139627#M37352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need an OUTPUT statement just before the Z+1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR you need to have a SET statement to bring in existing data with the variables in the first two array statements. Without set they are all missing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 15:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139627#M37352</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-06-12T15:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139628#M37353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;haha... what an error! thanks guys. Its working now, i had forgot to use the set statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 15:12:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139628#M37353</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2014-06-12T15:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139629#M37354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... maybe this is what you want ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;* make some fake data;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data have;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;array det_lyrica_p(7);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;array det_lyrica_s(7);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;do i=1 to 5;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;do j=1 to 7;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; det_lyrica_p(j) = ceil(5*ranuni(1234));&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; det_lyrica_s(j) = ceil(5*ranuni(1234));&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;drop i j;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;proc print data=have;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;* add new variables x1-x49 based on the values of &lt;STRONG style="font-family: 'courier new', courier;"&gt;det_lyrica_p&lt;/STRONG&gt; and &lt;STRONG style="font-family: 'courier new', courier;"&gt;det_lyrica_s;&lt;/STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;array p(7)&amp;nbsp;&amp;nbsp; det_lyrica_p1-det_lyrica_p7;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;array s(7)&amp;nbsp;&amp;nbsp; det_lyrica_s1-det_lyrica_s7;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;* as suggested by KSharp ... array with two dimensions;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;array x(7,7) x1-x49;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;do i=1 to 7;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;do j=1 to 7;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;* logical 1s (condition true) and 0s (condition false)&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; x(i,j) = p(i) eq 1 and s(j) eq 1;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;drop i j;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;proc print data=want;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 21:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139629#M37354</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2014-06-12T21:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139630#M37355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the multiply approach instead of if.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 06:05:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Nested-do-loop-in-sas/m-p/139630#M37355</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2014-06-13T06:05:07Z</dc:date>
    </item>
  </channel>
</rss>

