<?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: how to loops in following condition in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532590#M145949</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/259765"&gt;@K_coder&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Now how to join abc1 to abc12?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=abc out=abc12;
by index;
run;

proc print data=abc12;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To get required transformation...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why do you need to join it?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data attribute map should take care of the colour groupings, which is what you were after, doesn't it?&lt;/P&gt;</description>
    <pubDate>Mon, 04 Feb 2019 15:41:52 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-02-04T15:41:52Z</dc:date>
    <item>
      <title>how to loops in following condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532493#M145917</link>
      <description>&lt;P&gt;I have following data1(abc) which are representing coordinates-&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc;
input index Cor1 Cor2 Cor3 Cor4 Cor5 Cor6 Cor7 Cor8;
datalines;
1 1 2 4 12 6 10 5 11
2 1 1.5 4 11.5 6.5 10.5 5 13
3 1.5 2 4 12 6 10 5 11
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and data2(abc1) which represents classes w.r.t abc(data)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc1;
input class COORDINATE$;
datalines;
0 Cor1
0 Cor2
1 Cor3
2 Cor4
1 Cor5
2 Cor6 
1 Cor7
2 Cor8
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For following code can we able to do it automatic, without writing series statement each time?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=abc;
series X=index y=Cor1/lineattrs=(color=g);
series X=index y=Cor2/lineattrs=(color=g);
series X=index y=Cor3/lineattrs=(color=b);
series X=index y=Cor5/lineattrs=(color=b);
series X=index y=Cor7/lineattrs=(color=b);
series X=index y=Cor4/lineattrs=(color=r);
series X=index y=Cor6/lineattrs=(color=r);
series X=index y=Cor8/lineattrs=(color=r);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;if yes how?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note:-&lt;/P&gt;&lt;P&gt;1. Maximum(class)=3&lt;/P&gt;&lt;P&gt;2. If classes increase it should be increase in colors for line.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 04:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532493#M145917</guid>
      <dc:creator>K_coder</dc:creator>
      <dc:date>2019-02-04T04:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to loops in following condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532494#M145918</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;For following code can we able to do it automatic, without writing series statement each time?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Not with your current data structure. Change it so that CORR is one value and then the correlation ID (1 to &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; is in&amp;nbsp;another column:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Index ID Corr_Value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1 1 2&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1 2 4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1 3 12&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3 1 1.5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3 8 11&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then when you make your graph you can use the GROUP = to get separate lines:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=abc;
series x=index y=corr_value / group = ID;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;You can control the colours with your separate data set, using a data attribute map. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/259765"&gt;@K_coder&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have following data1(abc) which are representing coordinates-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc;
input index Cor1 Cor2 Cor3 Cor4 Cor5 Cor6 Cor7 Cor8;
datalines;
1 1 2 4 12 6 10 5 11
2 1 1.5 4 11.5 6.5 10.5 5 13
3 1.5 2 4 12 6 10 5 11
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and data2(abc1) which represents classes w.r.t abc(data)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc1;
input class COORDINATE$;
datalines;
0 Cor1
0 Cor2
1 Cor3
2 Cor4
1 Cor5
2 Cor6 
1 Cor7
2 Cor8
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For following code can we able to do it automatic, without writing series statement each time?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=abc;
series X=index y=Cor1/lineattrs=(color=g);
series X=index y=Cor2/lineattrs=(color=g);
series X=index y=Cor3/lineattrs=(color=b);
series X=index y=Cor5/lineattrs=(color=b);
series X=index y=Cor7/lineattrs=(color=b);
series X=index y=Cor4/lineattrs=(color=r);
series X=index y=Cor6/lineattrs=(color=r);
series X=index y=Cor8/lineattrs=(color=r);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if yes how?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note:-&lt;/P&gt;
&lt;P&gt;1. Maximum(class)=3&lt;/P&gt;
&lt;P&gt;2. If classes increase it should be increase in colors for line.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 05:01:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532494#M145918</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-04T05:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to loops in following condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532497#M145919</link>
      <description>&lt;P&gt;How to create such data transformation?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 05:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532497#M145919</guid>
      <dc:creator>K_coder</dc:creator>
      <dc:date>2019-02-04T05:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to loops in following condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532500#M145920</link>
      <description>PROC TRANSPOSE&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And an example of attribute maps:&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2013/04/02/attribute-maps-1/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2013/04/02/attribute-maps-1/&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Feb 2019 05:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532500#M145920</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-04T05:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to loops in following condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532509#M145922</link>
      <description>&lt;P&gt;Now how to join abc1 to abc12?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=abc out=abc12;
by index;
run;

proc print data=abc12;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To get required transformation...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 06:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532509#M145922</guid>
      <dc:creator>K_coder</dc:creator>
      <dc:date>2019-02-04T06:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to loops in following condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532564#M145939</link>
      <description>&lt;P&gt;Where do you get the color mapping:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0 = g&lt;/P&gt;
&lt;P&gt;1 = b&lt;/P&gt;
&lt;P&gt;2 = r&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's an important piece of the logic that you have in your head but is not in the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you could extend that list if you needed to, here is a way to automate the process:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;call execute ('proc sgplot data=abc;');&lt;/P&gt;
&lt;P&gt;do until (done);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set abc1 end=done;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;y + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;call execute ('series x=index y=Cor ' || put(y, 1.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;call execute('/lineattrs=(color=');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if class=0 then call execute('g');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;else if class=1 then call execute('b');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;else if class=2 then call execute('r');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;call execute ( ');' ) ;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;call execute('run;');&lt;/P&gt;
&lt;P&gt;stop;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 13:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532564#M145939</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-04T13:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to loops in following condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532590#M145949</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/259765"&gt;@K_coder&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Now how to join abc1 to abc12?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=abc out=abc12;
by index;
run;

proc print data=abc12;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To get required transformation...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why do you need to join it?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data attribute map should take care of the colour groupings, which is what you were after, doesn't it?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2019 15:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532590#M145949</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-04T15:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to loops in following condition</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532841#M146042</link>
      <description>Sorry my fault.&lt;BR /&gt;&lt;BR /&gt;Line 105 needs a closing parenthesis before the final semicolon.</description>
      <pubDate>Tue, 05 Feb 2019 05:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532841#M146042</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-05T05:31:08Z</dc:date>
    </item>
    <item>
      <title>Not working with Cor10, Cor11...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532844#M146045</link>
      <description>&lt;P&gt;Getting error at put when Cor increases&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute ('series x=index y=Cor ' || put(y, 1.);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After Cor9 and above Error Message-&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; + series x=date y=Cor*
                                    _
                                    22
                                    200
 ERROR 22-322: Syntax error, expecting one of the following: ;, /.  
 ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 05:50:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532844#M146045</guid>
      <dc:creator>K_coder</dc:creator>
      <dc:date>2019-02-05T05:50:38Z</dc:date>
    </item>
    <item>
      <title>What if column names data(abc) are different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532853#M146051</link>
      <description>&lt;P&gt;consider following condition&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc;
input index Abc Pqr Xyz A C D E xyz1;
datalines;
1 1 2 4 12 6 10 5 11
2 1 1.5 4 11.5 6.5 10.5 5 13
3 1.5 2 4 12 6 10 5 11
;

data abc1;
input class COORDINATE$;
datalines;
0 Abc
0 Pqr
1 Xyz
2 A
1 C
2 D 
1 E
2 xyz1
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In above case what should we do?&lt;/P&gt;&lt;P&gt;We have to rename the column names or have another option...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 06:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/532853#M146051</guid>
      <dc:creator>K_coder</dc:creator>
      <dc:date>2019-02-05T06:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: What if column names data(abc) are different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/533146#M146136</link>
      <description>&lt;P&gt;Got the solution-&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
call execute('proc sgplot data=abc;');
do until (done);
set abc1;
length s1 $100;
s1 = catx(' ','series x=index y=',COORDINATE);
call execute(s1);
call execute('/lineattrs=(color=');
if class=0 then call execute('g');
else if class=1 then call execute('b');
else if class=2 then call execute('y');
else if class=3 then call execute('r');
call execute ( ');' ) ;
end;
call execute('run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 06:23:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/533146#M146136</guid>
      <dc:creator>K_coder</dc:creator>
      <dc:date>2019-02-06T06:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: What if column names data(abc) are different</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/533272#M146190</link>
      <description>&lt;P&gt;Excellent!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 15:00:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-loops-in-following-condition/m-p/533272#M146190</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-06T15:00:34Z</dc:date>
    </item>
  </channel>
</rss>

