<?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: Put function output appearing as period (to use in MODZ function) in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Put-function-output-appearing-as-period-to-use-in-MODZ-function/m-p/852522#M37467</link>
    <description>&lt;P&gt;You have not told this step that you want to use the data entered:&lt;/P&gt;
&lt;P&gt;Instead of&lt;/P&gt;
&lt;PRE&gt;data e1;
put r;
e=modz(p,3);
;run;&lt;/PRE&gt;
&lt;P&gt;I think that you want&lt;/P&gt;
&lt;PRE&gt;data e1;
  &lt;FONT color="#800080"&gt;&lt;STRONG&gt; set p1;&lt;/STRONG&gt;&lt;/FONT&gt;
   put r;
   e=modz(p,3);
run;&lt;/PRE&gt;
&lt;P&gt;The SET statement is one of the statements to bring other data into the current data step code.&lt;/P&gt;
&lt;P&gt;You have a similar problem here with no data source:&lt;/P&gt;
&lt;PRE&gt;data send;
if(
e=0 then
put "send";
else
put "do not send"
;run;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Big&lt;/STRONG&gt;&lt;FONT size="4"&gt; problem: the numeric value 22101 you are using does not correspond to the date of 1 Oct 2022. It is actually 05JUL2020 when used with date functions. So your result would not be correct.&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt; When you want to specify a date value then you use a date literal such as r ='01OCT2022'd; The form of the text must be in one of the formats the DATE format uses. Strongly recommend using a 4-digit year so there is never any question. The quotes, can be single or double, and the letter D immediately following tell SAS to use the value as an internal date. Also this way it is easy for a human to know the actual date intended. Five-digit dates like 22101 are most likely interpreted as Julian dates (year followed by day sequence in year) and 22101 would be mid-April. Even if you had included the leading zero for day, such as 221001, that essentially random string of digits could be 22 Oct 2001 (or 1901 depending on system settings). &lt;/P&gt;
&lt;P&gt;So use the date literal construct.&lt;/P&gt;
&lt;P&gt;There are similar constructs for time and datetime values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jan 2023 16:01:14 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-01-06T16:01:14Z</dc:date>
    <item>
      <title>Put function output appearing as period (to use in MODZ function)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Put-function-output-appearing-as-period-to-use-in-MODZ-function/m-p/852516#M37465</link>
      <description>&lt;P&gt;I'm trying to write a piece of code that will send an email out every 3 days. To do that, I'm defining a variable for today which subtracts from an anchored date (Oct 1st, 2022) which is also a variable to give me a calculated number. Then, I'll use the MODZ function and if the output of the modz function is 0, then I will send an email.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'm getting stuck just before the modz function because although I am able to define my variables, I can't view them. The put function shows a "." in the output. This is also the case for the result of the modz function. My IF statement is then getting a "Expecting an arithmetic operator" error which may be because there is no number stored in the variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I get my put and modz function to output my calculation and variables instead of a period?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I've been using. The part I'm focusing on right now is bolded:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data p1;&lt;BR /&gt;k=today();&lt;BR /&gt;r=22101;&lt;BR /&gt;p=k-r;&lt;BR /&gt;;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data e1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;put r;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;e=modz(p,3);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data send;&lt;BR /&gt;if(&lt;BR /&gt;e=0 then&lt;BR /&gt;put "send";&lt;BR /&gt;else&lt;BR /&gt;put "do not send"&lt;BR /&gt;;run;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 15:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Put-function-output-appearing-as-period-to-use-in-MODZ-function/m-p/852516#M37465</guid>
      <dc:creator>aazzarello</dc:creator>
      <dc:date>2023-01-06T15:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Put function output appearing as period (to use in MODZ function)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Put-function-output-appearing-as-period-to-use-in-MODZ-function/m-p/852519#M37466</link>
      <description>&lt;P&gt;There are a number of errors in your DATA SEND code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no SET statement, so the variables in SEND are always missing. Plus other errors. And so this really has nothing to do with MODZ causing errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would simplify your code like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
    /* Update: Ballardw points out the 22101 is not really the date wanted */
    /* p=today()-22101; */
    /* So the fix is below */
    p=today()-'01OCT2022'd;
    e=mod(p,3);
    if e=0 then put "send";
    else put "do not send;
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>Fri, 06 Jan 2023 16:10:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Put-function-output-appearing-as-period-to-use-in-MODZ-function/m-p/852519#M37466</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-06T16:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Put function output appearing as period (to use in MODZ function)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Put-function-output-appearing-as-period-to-use-in-MODZ-function/m-p/852522#M37467</link>
      <description>&lt;P&gt;You have not told this step that you want to use the data entered:&lt;/P&gt;
&lt;P&gt;Instead of&lt;/P&gt;
&lt;PRE&gt;data e1;
put r;
e=modz(p,3);
;run;&lt;/PRE&gt;
&lt;P&gt;I think that you want&lt;/P&gt;
&lt;PRE&gt;data e1;
  &lt;FONT color="#800080"&gt;&lt;STRONG&gt; set p1;&lt;/STRONG&gt;&lt;/FONT&gt;
   put r;
   e=modz(p,3);
run;&lt;/PRE&gt;
&lt;P&gt;The SET statement is one of the statements to bring other data into the current data step code.&lt;/P&gt;
&lt;P&gt;You have a similar problem here with no data source:&lt;/P&gt;
&lt;PRE&gt;data send;
if(
e=0 then
put "send";
else
put "do not send"
;run;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Big&lt;/STRONG&gt;&lt;FONT size="4"&gt; problem: the numeric value 22101 you are using does not correspond to the date of 1 Oct 2022. It is actually 05JUL2020 when used with date functions. So your result would not be correct.&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt; When you want to specify a date value then you use a date literal such as r ='01OCT2022'd; The form of the text must be in one of the formats the DATE format uses. Strongly recommend using a 4-digit year so there is never any question. The quotes, can be single or double, and the letter D immediately following tell SAS to use the value as an internal date. Also this way it is easy for a human to know the actual date intended. Five-digit dates like 22101 are most likely interpreted as Julian dates (year followed by day sequence in year) and 22101 would be mid-April. Even if you had included the leading zero for day, such as 221001, that essentially random string of digits could be 22 Oct 2001 (or 1901 depending on system settings). &lt;/P&gt;
&lt;P&gt;So use the date literal construct.&lt;/P&gt;
&lt;P&gt;There are similar constructs for time and datetime values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2023 16:01:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Put-function-output-appearing-as-period-to-use-in-MODZ-function/m-p/852522#M37467</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-06T16:01:14Z</dc:date>
    </item>
  </channel>
</rss>

