<?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 Please let me know how to resolve issue in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59551#M16803</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By using the $7. format in your put statement you are corrupting your numeric values.&amp;nbsp; The outout of the put statement is always character so you should be using a proper numeric format to not obscure your result (basically you are rounding the the integer level instead of the the hundreth as you want).&amp;nbsp; To avoid the 'spaces' try using encasing your calculation in a strip().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; do month=1,2,3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do day=2,3,4,7,11,13,17;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if mod(day,2)=0 then year=2000; else year=2001;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; servicedate=mdy(month,day,year);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;currentdate=today()-day;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;yrdif=strip(put(round(yrdif(servicedate,currentdate,'ACT/ACT'),.01),best.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;put yrdif=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Sep 2011 16:00:14 GMT</pubDate>
    <dc:creator>FriedEgg</dc:creator>
    <dc:date>2011-09-01T16:00:14Z</dc:date>
    <item>
      <title>Please let me know how to resolve issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59547#M16799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have some test data related to subscribers where we have service date and based on this date, we need to calculate no of years of service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are using current month and using a yrdif function, but it kept failing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;put(round(YRDIF(ServiceDate,current_dt,'ACT/ACT'),.01),$7.) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If service date and current date are in yyyymmdd format and if service date is greater than current_dt or in less than current_dt, please let me know how to handle so I will not get any spaces in resulting value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;basesas9&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 12:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59547#M16799</guid>
      <dc:creator>sasbasls</dc:creator>
      <dc:date>2011-09-01T12:21:22Z</dc:date>
    </item>
    <item>
      <title>Please let me know how to resolve issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59548#M16800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A couple of questions:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Are you certain that current_dt is a date or might it be a datetime?&amp;nbsp; If it is a datetime, you'll have to enclose it with the datepart() function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. What are you trying to output the result to?&amp;nbsp; A text file?&amp;nbsp; A SAS dataset?&amp;nbsp; Your code, at least to the right of the put statement, appears to be correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. What do you want to output when Service_date is gt current date?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will get a most useful answer if the forum has a better understanding of what you are trying to accomplish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 12:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59548#M16800</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-01T12:45:02Z</dc:date>
    </item>
    <item>
      <title>Please let me know how to resolve issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59549#M16801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; 1. yes, it is only date in yyyymmdd format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 2. We are outputting as a character of 7 bytes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 3. if Service date is gt current date, we are making as zero.&amp;nbsp; and if Service date is blank we are defaulting date value to 17000101.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 13:26:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59549#M16801</guid>
      <dc:creator>sasbasls</dc:creator>
      <dc:date>2011-09-01T13:26:06Z</dc:date>
    </item>
    <item>
      <title>Please let me know how to resolve issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59550#M16802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then some of your questions confuse me.&amp;nbsp; 17000101 sure looks like a datetime value, namely July 15, 1960.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your variables are in fact datetime variables, then you will need to use datepart for one or both variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You originally asked: "let me know how to handle so I will not get any spaces in resulting value".&amp;nbsp; Please explain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And, finally, you are outputting to what?&amp;nbsp; A text file?&amp;nbsp; A SAS dataset?&amp;nbsp; A report?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 13:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59550#M16802</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-01T13:36:44Z</dc:date>
    </item>
    <item>
      <title>Please let me know how to resolve issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59551#M16803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By using the $7. format in your put statement you are corrupting your numeric values.&amp;nbsp; The outout of the put statement is always character so you should be using a proper numeric format to not obscure your result (basically you are rounding the the integer level instead of the the hundreth as you want).&amp;nbsp; To avoid the 'spaces' try using encasing your calculation in a strip().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; do month=1,2,3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do day=2,3,4,7,11,13,17;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if mod(day,2)=0 then year=2000; else year=2001;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; servicedate=mdy(month,day,year);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;currentdate=today()-day;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;yrdif=strip(put(round(yrdif(servicedate,currentdate,'ACT/ACT'),.01),best.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;put yrdif=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 16:00:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59551#M16803</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-09-01T16:00:14Z</dc:date>
    </item>
    <item>
      <title>Please let me know how to resolve issue</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59552#M16804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post some sample data and the output you want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2011 02:27:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Please-let-me-know-how-to-resolve-issue/m-p/59552#M16804</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-09-02T02:27:31Z</dc:date>
    </item>
  </channel>
</rss>

