<?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: Double %Do Loop didn't work? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852965#M337165</link>
    <description>&lt;P&gt;You might indicate what code you are attempting to generate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like a very cumbersome approach without more details.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One suspects that you have created an unstable situation with one or more attempts to execute the code and it is time to restart SAS if the Log isn't actually showing the MPRINT output.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 00:08:47 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-01-10T00:08:47Z</dc:date>
    <item>
      <title>Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852939#M337146</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Could anyone let me know why my Do loop code didn't work?&amp;nbsp; Thanks.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Y1=sum;
%let Y2=los;
%let X1=age;
%let X2=Preterm;
%let X3=ICU;

%macro aaa;


proc npar1way WILCOXON data=Pre_Cal;

%do z  = 1 %to 2;
%do i  = 1 %to 3;

	class &amp;amp;&amp;amp;X&amp;amp;i..;
	var &amp;amp;&amp;amp;Y&amp;amp;z..;

	%end; 
	%end; ;

run;

%mend;
%aaa;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jan 2023 21:28:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852939#M337146</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-01-09T21:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852940#M337147</link>
      <description>&lt;P&gt;You have extra dots in the CLASS and VAR statements.&amp;nbsp; Get rid of them (at least get rid of one per statement).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No, on second thought that's not it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you considered posting the log?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 21:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852940#M337147</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-01-09T21:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852942#M337149</link>
      <description>&lt;P&gt;I run the codes, then nothing happed.&amp;nbsp; Log window message was shown.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;345 options mprint symbolgen mlogic;&lt;BR /&gt;346 %let Y1=sum;&lt;BR /&gt;347 %let Y2=los;&lt;BR /&gt;348 %let X1=age;&lt;BR /&gt;349 %let X2=Preterm;&lt;BR /&gt;350 %let X3=ICU;&lt;BR /&gt;&lt;BR /&gt;353&lt;BR /&gt;354&lt;BR /&gt;355 %macro aaa;&lt;BR /&gt;356&lt;BR /&gt;357&lt;BR /&gt;358 proc npar1way WILCOXON data=Pre_Cal;&lt;BR /&gt;359&lt;BR /&gt;360 %do z = 1 %to 2;&lt;BR /&gt;361 %do i = 1 %to 3;&lt;BR /&gt;362&lt;BR /&gt;363 class &amp;amp;&amp;amp;X&amp;amp;i..;&lt;BR /&gt;364 var &amp;amp;&amp;amp;Y&amp;amp;z..;&lt;BR /&gt;365&lt;BR /&gt;366 %end;&lt;BR /&gt;367 %end; ;&lt;BR /&gt;368&lt;BR /&gt;369 run;&lt;BR /&gt;370&lt;BR /&gt;371 %mend;&lt;BR /&gt;372 %aaa;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Mon, 09 Jan 2023 21:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852942#M337149</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-01-09T21:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852944#M337151</link>
      <description>I got rid of one dot in both Class and Var statements, but it is still not working.</description>
      <pubDate>Mon, 09 Jan 2023 21:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852944#M337151</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-01-09T21:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852945#M337152</link>
      <description>&lt;P&gt;That's really it???&amp;nbsp; No further messages after that in the log???&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 21:35:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852945#M337152</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-01-09T21:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852947#M337153</link>
      <description>yes, that is.</description>
      <pubDate>Mon, 09 Jan 2023 21:36:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852947#M337153</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2023-01-09T21:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852949#M337154</link>
      <description>&lt;P&gt;Them something else must have gone wrong in the earlier code ... a missing semicolon, a missing %mend statement, ... something that isn't presented here.&amp;nbsp; I would suggest starting a new SAS session and re-running the code.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 21:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852949#M337154</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-01-09T21:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852950#M337155</link>
      <description>&lt;P&gt;What SAS code is it that you are trying to generate?&lt;/P&gt;
&lt;P&gt;I do not use that PROC but the syntax you are trying to generate looks really fishy to me.&lt;/P&gt;
&lt;P&gt;What would this code even mean?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc npar1way WILCOXON data=Pre_Cal;
class age;
var sum;

class preterm;
var sum;

class ICU;
var sum;

class age;
var los;

class preterm;
var los;

class ICU;
var los;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Normally you just have one VAR statement and one CLASS statement in a proc.&amp;nbsp; You could use multiple class statements if for some reason you needed to use differing options for some of the class variables.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 21:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852950#M337155</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-09T21:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852952#M337157</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;is correct, your loop is in the wrong location&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See code below for the fix and example that works.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Y1=sum;
%let Y2=los;
%let X1=age;
%let X2=Preterm;
%let X3=ICU;

%macro aaa;

%do z  = 1 %to 2;
%do i  = 1 %to 3;
proc npar1way WILCOXON data=Pre_Cal;



	class &amp;amp;&amp;amp;X&amp;amp;i..;
	var &amp;amp;&amp;amp;Y&amp;amp;z..;



run;
	%end; 
	%end; ;
%mend;

options mprint symbolgen;
%aaa;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Y1=ageatstart;
%let Y2=height;
%let X1=weight_status;
%let X2=deathcause;
%let X3=smoking_status;

%macro aaa;

%do z  = 1 %to 2;
%do i  = 1 %to 3;
proc npar1way WILCOXON data=sashelp.heart;



	class &amp;amp;&amp;amp;X&amp;amp;i..;
	var &amp;amp;&amp;amp;Y&amp;amp;z..;



run;
	%end; 
	%end; ;
%mend;

options mprint symbolgen;
%aaa;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jan 2023 22:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852952#M337157</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-01-09T22:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852953#M337158</link>
      <description>&lt;P&gt;Looks like you only need to the %DO loop over the CLASS variables.&amp;nbsp; You can only have one CLASS variable but you can have many variables on the VAR statement.&lt;/P&gt;
&lt;P&gt;You also only need TWO macro variables. One to list the CLASS variables and one to list the analysis variables.&lt;/P&gt;
&lt;P&gt;Making a "series" of macro variables is just adding extra work for no real advantage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let classes=age preterm icu;
%let varlist=sum&amp;nbsp;los;
%do&amp;nbsp;i=1&amp;nbsp;to&amp;nbsp;%sysfunc(countw(&amp;amp;classes,%str( )));
proc npar1way WILCOXON data=Pre_Cal;
  class %scan(&amp;amp;classes,&amp;amp;i,%str( ));
  var &amp;amp;varlist;
run;
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jan 2023 22:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852953#M337158</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-09T22:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Double %Do Loop didn't work?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852965#M337165</link>
      <description>&lt;P&gt;You might indicate what code you are attempting to generate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like a very cumbersome approach without more details.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One suspects that you have created an unstable situation with one or more attempts to execute the code and it is time to restart SAS if the Log isn't actually showing the MPRINT output.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 00:08:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Double-Do-Loop-didn-t-work/m-p/852965#M337165</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-10T00:08:47Z</dc:date>
    </item>
  </channel>
</rss>

