<?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: Re coding multiple variables with three categories at once in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/564973#M158528</link>
    <description>&lt;P&gt;Sorry I am not very clear of your code suggestion I used like this and it did not work.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; LANLYSIS.Clinic_MEDICATION_CODED;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; LANLYSIS.Clinic1_SYMPTOMS_CODED;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;METRONIDAZOLE_500MG_POBID_X_7D =WHICHC(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'METRONIDAZOLE 500MG POBID X 7D'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; , CEFTRIAXONE_ROCEPHIN_250MG_IM=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'CEFTRIAXONE(ROCEPHIN)250MG IM'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) &amp;gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;the result is metronidazole all coded 0 and nothing happened in CEFTRIAXONE_ROCEPHIN_250MG_IM.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Please help.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Thank you.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jun 2019 17:25:29 GMT</pubDate>
    <dc:creator>Dhana18</dc:creator>
    <dc:date>2019-06-10T17:25:29Z</dc:date>
    <item>
      <title>Re coding multiple variables with three categories at once</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/564936#M158516</link>
      <description>&lt;P&gt;I have data set like this with more than 50 variables&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Doxycycline_100MG_PO_BID_X_07&lt;/TD&gt;&lt;TD&gt;ACYCLOVIR_400MG_TID_X_7_DAYS&lt;/TD&gt;&lt;TD&gt;METRONIDAZOLE_500MG_POBID_X14D&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DOXYCYCLINE 100MG PO BID X 07&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;ACYCLOVIR 400MG TID X 7 DAYS&lt;/TD&gt;&lt;TD&gt;METRONIDAZOLE 500MG POBID X14D&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;DOXYCYCLINE 100MG PO BID X 07&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;METRONIDAZOLE 500MG POBID X14D&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;ACYCLOVIR 400MG TID X 7 DAYS&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I want to code these&amp;nbsp; as if&amp;nbsp;METRONIDAZOLE_500MG_POBID_X14D="METRONIDAZOLE 500MG POBID X14D" then&amp;nbsp;METRONIDAZOLE_500MG_POBID_X14D="1"; else&amp;nbsp;METRONIDAZOLE_500MG_POBID_X14D="0";&lt;/P&gt;&lt;P&gt;&amp;nbsp;How can I do it at once?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 16:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/564936#M158516</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2019-06-10T16:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Re coding multiple variables with three categories at once</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/564944#M158520</link>
      <description>WHICHC()&lt;BR /&gt;&lt;BR /&gt;metrodizale = whichc('XXXXXdlkfjdklfjdlkfd', &amp;lt;list of variables here&amp;gt;)  &amp;gt; 0;</description>
      <pubDate>Mon, 10 Jun 2019 16:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/564944#M158520</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-10T16:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Re coding multiple variables with three categories at once</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/564973#M158528</link>
      <description>&lt;P&gt;Sorry I am not very clear of your code suggestion I used like this and it did not work.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; LANLYSIS.Clinic_MEDICATION_CODED;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; LANLYSIS.Clinic1_SYMPTOMS_CODED;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;METRONIDAZOLE_500MG_POBID_X_7D =WHICHC(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'METRONIDAZOLE 500MG POBID X 7D'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; , CEFTRIAXONE_ROCEPHIN_250MG_IM=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'CEFTRIAXONE(ROCEPHIN)250MG IM'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) &amp;gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;the result is metronidazole all coded 0 and nothing happened in CEFTRIAXONE_ROCEPHIN_250MG_IM.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Please help.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Thank you.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 17:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/564973#M158528</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2019-06-10T17:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Re coding multiple variables with three categories at once</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/564976#M158529</link>
      <description>&lt;P&gt;it should only be two categories, if the response is present that should be coded "1" if the response is missing then that should be coded "0"&lt;/P&gt;&lt;P&gt;please help my life make my life easier.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 17:40:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/564976#M158529</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2019-06-10T17:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Re coding multiple variables with three categories at once</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/565003#M158538</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212762"&gt;@Dhana18&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please help my life make my life easier.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you try reading the WHICHC() documentation? That's the fastest solution besides me just coding it for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please re-read my answer, you didn't put the parameters in properly to the WHICHC() function. The first is the string you're looking for and the second is the variables that may contain that string. Then it returns the index of the variable if it's found or 0 if not found. So you can check if the return value is greater than 0 and it will get coded to a 0/1 automatically. Not sure why you put the 0 in quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's a single line solution to get your answer. If it doesn't work please post your code using the insert code button and the log indicating the error?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 18:46:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-coding-multiple-variables-with-three-categories-at-once/m-p/565003#M158538</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-10T18:46:43Z</dc:date>
    </item>
  </channel>
</rss>

