<?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 Macro for repeating variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-repeating-variables/m-p/176211#M33768</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data investor1;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;set investor ;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;Col_group = substr(d_col_group,3);&amp;nbsp;&amp;nbsp; &lt;BR /&gt;Col_group_sort=substr(d_col_group,1,1);&amp;nbsp;&amp;nbsp; &lt;BR /&gt;if ls_step_cd ='322' then do; step_desc ='QA Apprvd RPP';Point_Value=1;if Col_group = 'A' then Col_group_sort='E';end;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;if ls_step_cd ='322' then do; step_desc ='QA Apprvd RPP';Point_Value=1;if Col_group = 'B' then Col_group_sort='C';end; &lt;BR /&gt;if ls_step_cd ='322' then do; step_desc ='QA Apprvd RPP';Point_Value=1;if Col_group = 'C' then Col_group_sort='F';end; &lt;BR /&gt;if ls_step_cd ='323' then do; step_desc ='QA Apprvd ;Point_Value=1;if Col_group = 'A' then Col_group_sort='E';end;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;if ls_step_cd ='323' then do; step_desc ='QA Apprvd ;Point_Value=1;if Col_group = 'B' then Col_group_sort='C';end; &lt;BR /&gt;if ls_step_cd ='323' then do; step_desc ='QA Apprvd ;Point_Value=1;if Col_group = 'C' then Col_group_sort='F';end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to do a macro.&amp;nbsp; In this for each step_cd there will be several scenarios.&amp;nbsp; The step_decr and the point value will be the same for each step_cd.&amp;nbsp; The col_group and col_group sort will vary depending on the col_group.&amp;nbsp; Instead of listing each scenario, I want to do a macro based on the scenarios I just described&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Dec 2013 04:03:05 GMT</pubDate>
    <dc:creator>Q1983</dc:creator>
    <dc:date>2013-12-18T04:03:05Z</dc:date>
    <item>
      <title>Macro for repeating variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-repeating-variables/m-p/176211#M33768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data investor1;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;set investor ;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;Col_group = substr(d_col_group,3);&amp;nbsp;&amp;nbsp; &lt;BR /&gt;Col_group_sort=substr(d_col_group,1,1);&amp;nbsp;&amp;nbsp; &lt;BR /&gt;if ls_step_cd ='322' then do; step_desc ='QA Apprvd RPP';Point_Value=1;if Col_group = 'A' then Col_group_sort='E';end;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;if ls_step_cd ='322' then do; step_desc ='QA Apprvd RPP';Point_Value=1;if Col_group = 'B' then Col_group_sort='C';end; &lt;BR /&gt;if ls_step_cd ='322' then do; step_desc ='QA Apprvd RPP';Point_Value=1;if Col_group = 'C' then Col_group_sort='F';end; &lt;BR /&gt;if ls_step_cd ='323' then do; step_desc ='QA Apprvd ;Point_Value=1;if Col_group = 'A' then Col_group_sort='E';end;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;if ls_step_cd ='323' then do; step_desc ='QA Apprvd ;Point_Value=1;if Col_group = 'B' then Col_group_sort='C';end; &lt;BR /&gt;if ls_step_cd ='323' then do; step_desc ='QA Apprvd ;Point_Value=1;if Col_group = 'C' then Col_group_sort='F';end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to do a macro.&amp;nbsp; In this for each step_cd there will be several scenarios.&amp;nbsp; The step_decr and the point value will be the same for each step_cd.&amp;nbsp; The col_group and col_group sort will vary depending on the col_group.&amp;nbsp; Instead of listing each scenario, I want to do a macro based on the scenarios I just described&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2013 04:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-repeating-variables/m-p/176211#M33768</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2013-12-18T04:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for repeating variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-repeating-variables/m-p/176212#M33769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;Hi&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;Can you post the sample data and required format .That would help us to clearly understand your requirement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;Sanjeev.K&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2013 05:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-repeating-variables/m-p/176212#M33769</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-12-18T05:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for repeating variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-repeating-variables/m-p/176213#M33770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;And As per my understanding,no need of using macros for your senario.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;You can create a user defined format for displaying Col_group_sort column based on the Col_group values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;I simplified your code.Can you test bellow code on your data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;Proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;format&lt;/STRONG&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; $ Grpsort&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;"A"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;"E"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;"B"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;"C"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;"C"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;"F"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;Data&lt;/STRONG&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; Want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;Set&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; Have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; ls_step_cd =&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;'322'&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;step_desc =&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;'QA Apprvd RPP'&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;Point_Value=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: Consolas;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;Col_group_sort=put(Col_group,&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: teal; font-size: 10pt;"&gt;$Grpsort.&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; ls_step_cd =&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;'323'&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;step_desc =&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: purple; font-size: 10pt;"&gt;'QA Apprvd'&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt; ;Point_Value=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: Consolas;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;Col_group_sort=put(Col_group,&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: teal; font-size: 10pt;"&gt;$Grpsort.&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: Consolas;"&gt;Run&lt;/STRONG&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: verdana,geneva;"&gt;Sanjeev.K&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2013 05:27:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-repeating-variables/m-p/176213#M33770</guid>
      <dc:creator>kuridisanjeev</dc:creator>
      <dc:date>2013-12-18T05:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for repeating variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-repeating-variables/m-p/176214#M33771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Hi, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;In this case, you need to fix how many instances of step_cd and col_group...If there's so many subjects of step_cd and col_group then only you should think about Macros or formats...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Based on SAS Codes, it will be difficult to answer your question so please post some sample data and output you want...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;-Urvish&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Dec 2013 10:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-repeating-variables/m-p/176214#M33771</guid>
      <dc:creator>UrvishShah</dc:creator>
      <dc:date>2013-12-18T10:32:24Z</dc:date>
    </item>
  </channel>
</rss>

