<?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 splitting a variable in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/splitting-a-variable-in-SAS/m-p/846519#M334630</link>
    <description>&lt;P&gt;Hello programmers,&lt;BR /&gt;I don't know if this title is really what I want to implement, but I will explain. And I'll be glad to get more insight.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on the BRFSS Dataset, and I want to get the number of times per day or week a patient uses a medication.&lt;/P&gt;&lt;P&gt;For example, observations with 301-399 for the variable ILP08_3 recorded their number of times in days, while observations with 401-499 recorded their number of times in weeks.&lt;/P&gt;&lt;P&gt;So if an observation recorded 306, "3" already lets us know we are dealing with a record in days, while "06" indicates the number of times. So, this case used their medication 6 times in a day.&lt;/P&gt;&lt;P&gt;Same way if an observation was recorded as 402. It means that this case used their medication 2 times a week.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do: I want to be able to split the response into 2. For example, if a response is "306'&amp;nbsp; for a case with the variable ILP08_3, I want to split it into 2 variables with "3" and "06" (numeric) on different columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate suggestions or referrals.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChuksManuel_0-1669585655701.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77763i04AA83219E5F4ADA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChuksManuel_0-1669585655701.png" alt="ChuksManuel_0-1669585655701.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 27 Nov 2022 22:08:53 GMT</pubDate>
    <dc:creator>ChuksManuel</dc:creator>
    <dc:date>2022-11-27T22:08:53Z</dc:date>
    <item>
      <title>splitting a variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/splitting-a-variable-in-SAS/m-p/846519#M334630</link>
      <description>&lt;P&gt;Hello programmers,&lt;BR /&gt;I don't know if this title is really what I want to implement, but I will explain. And I'll be glad to get more insight.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on the BRFSS Dataset, and I want to get the number of times per day or week a patient uses a medication.&lt;/P&gt;&lt;P&gt;For example, observations with 301-399 for the variable ILP08_3 recorded their number of times in days, while observations with 401-499 recorded their number of times in weeks.&lt;/P&gt;&lt;P&gt;So if an observation recorded 306, "3" already lets us know we are dealing with a record in days, while "06" indicates the number of times. So, this case used their medication 6 times in a day.&lt;/P&gt;&lt;P&gt;Same way if an observation was recorded as 402. It means that this case used their medication 2 times a week.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do: I want to be able to split the response into 2. For example, if a response is "306'&amp;nbsp; for a case with the variable ILP08_3, I want to split it into 2 variables with "3" and "06" (numeric) on different columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate suggestions or referrals.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChuksManuel_0-1669585655701.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77763i04AA83219E5F4ADA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChuksManuel_0-1669585655701.png" alt="ChuksManuel_0-1669585655701.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 22:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/splitting-a-variable-in-SAS/m-p/846519#M334630</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2022-11-27T22:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: splitting a variable in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/splitting-a-variable-in-SAS/m-p/846521#M334631</link>
      <description>&lt;P&gt;Let's use simple math. First variable: divide by 100 and then find the integer lower than this result (the FLOOR function). Then the second variable is simply the remainder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
    code=306;
    first_variable=floor(code/100);
    second_variable=code - first_variable*100;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Nov 2022 22:47:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/splitting-a-variable-in-SAS/m-p/846521#M334631</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-27T22:47:58Z</dc:date>
    </item>
  </channel>
</rss>

