<?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 Splitning one variable to multiple variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690801#M210180</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;In my dataset each row cointains information about one individual and their diagnosis code. The information on each individual's different diagnos is stored in one variable that can contain multiple diagnosis ( see 'data have'). I would like to split each diagnos code in to separate variables.&amp;nbsp; ('data want').&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input id $ ICD $;&lt;BR /&gt;cards;&lt;BR /&gt;1 I63 H45 T11&lt;BR /&gt;2&amp;nbsp; C03 D25&lt;BR /&gt;3&amp;nbsp; J11 S54 A10 R45&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;id $ ICD1 $ ICD2 $ ICD3 $ ICD4 $;&lt;/P&gt;
&lt;P&gt;1 I63 H45 T11 .&lt;BR /&gt;2&amp;nbsp; C03 D25 . .&lt;BR /&gt;3&amp;nbsp; J11 S54 A10 R45&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Sun, 11 Oct 2020 17:25:04 GMT</pubDate>
    <dc:creator>Chris_LK_87</dc:creator>
    <dc:date>2020-10-11T17:25:04Z</dc:date>
    <item>
      <title>Splitning one variable to multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690801#M210180</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;In my dataset each row cointains information about one individual and their diagnosis code. The information on each individual's different diagnos is stored in one variable that can contain multiple diagnosis ( see 'data have'). I would like to split each diagnos code in to separate variables.&amp;nbsp; ('data want').&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input id $ ICD $;&lt;BR /&gt;cards;&lt;BR /&gt;1 I63 H45 T11&lt;BR /&gt;2&amp;nbsp; C03 D25&lt;BR /&gt;3&amp;nbsp; J11 S54 A10 R45&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;id $ ICD1 $ ICD2 $ ICD3 $ ICD4 $;&lt;/P&gt;
&lt;P&gt;1 I63 H45 T11 .&lt;BR /&gt;2&amp;nbsp; C03 D25 . .&lt;BR /&gt;3&amp;nbsp; J11 S54 A10 R45&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 17:25:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690801#M210180</guid>
      <dc:creator>Chris_LK_87</dc:creator>
      <dc:date>2020-10-11T17:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Splitning one variable to multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690805#M210182</link>
      <description>&lt;P&gt;&lt;SPAN style="background-color: transparent; color: black; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; font-size: inherit; white-space: pre; word-spacing: normal;"&gt;Much better: split it into observations:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have (rename=(icd=_icd));
length icd $3;
do i = 1 to countw(_icd);
  icd = scan(_icd,i);
  output;
end;
keep id icd;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 11 Oct 2020 17:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690805#M210182</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-11T17:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Splitning one variable to multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690820#M210187</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321775"&gt;@Chris_LK_87&lt;/a&gt;&amp;nbsp; Do all those ICD's consistently have a length of 3 bytes?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Oct 2020 20:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690820#M210187</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-10-11T20:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: Splitning one variable to multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690880#M210203</link>
      <description>&lt;P&gt;1.&amp;nbsp; Format your SAS code using the "SAS Code" icon.&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; When I paste your code into SAS, the first data step doesn't give the correct results.&amp;nbsp; The second data step fails.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BZZZZZZZZZZZZZZZZZZZZZZZ!&amp;nbsp; Try again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S.: Use the SCAN function and PROC TRANSPOSE (or an array - TRANSPOSE would be more flexible).&amp;nbsp; Read the doc for more details.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 04:23:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690880#M210203</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2020-10-12T04:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: Splitning one variable to multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690890#M210209</link>
      <description>Yes, they have a length of 3 bytes.</description>
      <pubDate>Mon, 12 Oct 2020 06:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitning-one-variable-to-multiple-variables/m-p/690890#M210209</guid>
      <dc:creator>Chris_LK_87</dc:creator>
      <dc:date>2020-10-12T06:36:23Z</dc:date>
    </item>
  </channel>
</rss>

