<?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: Switching the variable information based on the certain conditions? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/589189#M75936</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;A id="link_28" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151" target="_self"&gt;&lt;SPAN class="login-bold"&gt;Jagadishkatam&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most of your codes are correct, except adding one "$" to the character switch.&amp;nbsp; It's because I have multiple character variables.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2019 20:25:00 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2019-09-16T20:25:00Z</dc:date>
    <item>
      <title>Switching the variable information based on the certain conditions?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586130#M75823</link>
      <description>&lt;P&gt;&lt;SPAN data-preserver-spaces="true"&gt;Hello experts:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-preserver-spaces="true"&gt;I would like to do the following steps.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN data-preserver-spaces="true"&gt;The dataset has the variables list below:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;OL&gt;
&lt;LI class="ql-indent-1"&gt;&lt;SPAN data-preserver-spaces="true"&gt;Error&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="ql-indent-1"&gt;&lt;SPAN data-preserver-spaces="true"&gt;Dose1_Group1&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="ql-indent-1"&gt;&lt;SPAN data-preserver-spaces="true"&gt;Date1_Group1&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="ql-indent-1"&gt;&lt;SPAN data-preserver-spaces="true"&gt;Productor1_Group1&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="ql-indent-1"&gt;&lt;SPAN data-preserver-spaces="true"&gt;Manufacture1_Group1&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="ql-indent-1"&gt;&lt;SPAN data-preserver-spaces="true"&gt;Dose2_Group2&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="ql-indent-1"&gt;&lt;SPAN data-preserver-spaces="true"&gt;Date2_Group2&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="ql-indent-1"&gt;&lt;SPAN data-preserver-spaces="true"&gt;Productor2_Group2&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI class="ql-indent-1"&gt;&lt;SPAN data-preserver-spaces="true"&gt;Manufacture2_Group2&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;LI&gt;&lt;SPAN data-preserver-spaces="true"&gt;When variable 'Error' =1, I would like to switch the group 1 variables which are 'Dose1,' 'Date1,' 'Productor1,' 'Manufacture1.' with the group 2 variable 'Dose2,' 'Date2,' 'Productor2,' 'Manufacture2.'&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN data-preserver-spaces="true"&gt;When variable 'Error' =0, I DO NOT want to switch the group 1 variables which are 'Dose1,' 'Date1,' 'Productor1,' 'Manufacture1.' with the group 2 variable 'Dose2,' 'Date2,' 'Productor2,' 'Manufacture2.'&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN data-preserver-spaces="true"&gt;I am wondering if the SAS could perform this procedure. Thanks ahead.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586130#M75823</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2019-09-04T14:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Switching the variable information based on the certain conditions?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586132#M75824</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    if error=1 then do;
        temp=dose1_group1;
        dose1_group1=dose2_group2;
        dose2_group2=temp;
        /* Repeat the above for all other variables */
        /* which could be done using ARRAYs if desired */
    end;
    drop temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, why make your variable names so complicated? Wouldn't dose1 and dose2 be sufficient, instead of dose1_group1 and dose2_group2?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586132#M75824</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-04T14:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Switching the variable information based on the certain conditions?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586141#M75825</link>
      <description>&lt;P&gt;If you consider that except error variable, all the other variables are character then you can use arrays as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array grp1(*) $ Dose1_Group1 Date1_Group1 Productor1_Group1 Manufacture1_Group1;
array grp2(*) $ Dose2_Group2 Date2_Group2 Productor2_Group2 Manufacture2_Group2;
array grp3(*) $ temp1 temp2 temp3 temp4;
do i = 1 to dim(grp1);
grp3(i)=grp1(i);
if error=1 then do;
grp1(i)=grp2(i);
grp2(i)=grp3(i);
end;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586141#M75825</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-04T14:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Switching the variable information based on the certain conditions?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586150#M75826</link>
      <description>&lt;P&gt;I apologize I didn't specify the variables.&amp;nbsp; Some variables like dose, date, and product are numeric, some variable like manufacture is character.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586150#M75826</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2019-09-04T14:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Switching the variable information based on the certain conditions?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586153#M75827</link>
      <description>&lt;P&gt;Then you can try the below code so as to reduce the number of the lines&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array grp1(*) Dose1_Group1 Date1_Group1 Productor1_Group1 ;
array grp2(*) Dose2_Group2 Date2_Group2 Productor2_Group2 ;
array grp3(*) temp1 temp2 temp3 ;
do i = 1 to dim(grp1);
grp3(i)=grp1(i);
if error=1 then do;
grp1(i)=grp2(i);
grp2(i)=grp3(i);
end;
end;
if error=1 then do;
temp4=Manufacture1_Group1;
Manufacture1_Group1=Manufacture2_Group2;
Manufacture2_Group2=temp4;
end;
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, 04 Sep 2019 14:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/586153#M75827</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-04T14:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Switching the variable information based on the certain conditions?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/589189#M75936</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;A id="link_28" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151" target="_self"&gt;&lt;SPAN class="login-bold"&gt;Jagadishkatam&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most of your codes are correct, except adding one "$" to the character switch.&amp;nbsp; It's because I have multiple character variables.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 20:25:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Switching-the-variable-information-based-on-the-certain/m-p/589189#M75936</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2019-09-16T20:25:00Z</dc:date>
    </item>
  </channel>
</rss>

