<?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 Only keep last two digits in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Only-keep-last-two-digits/m-p/788728#M252254</link>
    <description>&lt;P&gt;I want the 100th place of the visit number to correspond with the PERIOD number, where period is based on the subject's individual timeline rather than the study timeline (&lt;EM&gt;e.g.&lt;/EM&gt; Subject B joins the study during second round of drug administration (VISHAVE 300s). Since this drug and follow-up period would be Subject B's first, it counts as Period 1 (VISWANT 200s)).&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Period 1 = Visit 200s&lt;/LI&gt;
&lt;LI&gt;Period 2 = Visit 300s&lt;/LI&gt;
&lt;LI&gt;Period 3 = Visit 400s&lt;/LI&gt;
&lt;LI&gt;Period 4 = Visit 500s&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I essentially want to make sure each visit number starts with the associated period number + 1. I figured the easiest way would be to save the last two digits as a temporary variable and then add (period+1)*100.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;e.g.&lt;/EM&gt; VISHAVE = 312 and PERIOD = 1, then TMP = 12&lt;/P&gt;
&lt;P&gt;VISWANT = (PERIOD+1)*100 + TMP = (2)*100 + 12 = 212&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Is there a way to only keep a value up to the tenth place?&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data visits;
 input id period vishave viswant @@;
 cards;
	1	1	200	200	1	1	201	201
	1	2	300	300	1	2	301	300
	1	3	400	400
	2	1	200	200	2	1	201	201
	2	2	400	300	2	2	402	302
	2	3	500	400	2	3	501	401
	3	1	300	200	3	1	301	201	3	1	306	206
	4	2	500	300	4	2	503	303
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 06 Jan 2022 19:47:49 GMT</pubDate>
    <dc:creator>mariko5797</dc:creator>
    <dc:date>2022-01-06T19:47:49Z</dc:date>
    <item>
      <title>Only keep last two digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-keep-last-two-digits/m-p/788728#M252254</link>
      <description>&lt;P&gt;I want the 100th place of the visit number to correspond with the PERIOD number, where period is based on the subject's individual timeline rather than the study timeline (&lt;EM&gt;e.g.&lt;/EM&gt; Subject B joins the study during second round of drug administration (VISHAVE 300s). Since this drug and follow-up period would be Subject B's first, it counts as Period 1 (VISWANT 200s)).&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Period 1 = Visit 200s&lt;/LI&gt;
&lt;LI&gt;Period 2 = Visit 300s&lt;/LI&gt;
&lt;LI&gt;Period 3 = Visit 400s&lt;/LI&gt;
&lt;LI&gt;Period 4 = Visit 500s&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I essentially want to make sure each visit number starts with the associated period number + 1. I figured the easiest way would be to save the last two digits as a temporary variable and then add (period+1)*100.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;e.g.&lt;/EM&gt; VISHAVE = 312 and PERIOD = 1, then TMP = 12&lt;/P&gt;
&lt;P&gt;VISWANT = (PERIOD+1)*100 + TMP = (2)*100 + 12 = 212&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Is there a way to only keep a value up to the tenth place?&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data visits;
 input id period vishave viswant @@;
 cards;
	1	1	200	200	1	1	201	201
	1	2	300	300	1	2	301	300
	1	3	400	400
	2	1	200	200	2	1	201	201
	2	2	400	300	2	2	402	302
	2	3	500	400	2	3	501	401
	3	1	300	200	3	1	301	201	3	1	306	206
	4	2	500	300	4	2	503	303
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jan 2022 19:47:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-keep-last-two-digits/m-p/788728#M252254</guid>
      <dc:creator>mariko5797</dc:creator>
      <dc:date>2022-01-06T19:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Only keep last two digits</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Only-keep-last-two-digits/m-p/788741#M252266</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;Is there a way to only keep a value up to the tenth place?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I assume you mean that if the value is 304, then you want 4. If the value is 312 then you want 12. Am I correct? (If not, explain more clearly and give examples of "Is there a way to only keep a value up to the tenth place?")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the MOD function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;wanted_variable = mod(period,100);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jan 2022 21:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Only-keep-last-two-digits/m-p/788741#M252266</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-06T21:30:48Z</dc:date>
    </item>
  </channel>
</rss>

