<?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: Can this be re-written using a data step only? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688408#M209120</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA DATES;
    START_DATE_PM = INTNX('MONTH',TODAY(),-1,'B');
    CD3PM = INTNX('DAY',START_DATE_PM,2);
    START_DATE_CM = INTNX('MONTH',TODAY(),0,'B');
    CD2CM = INTNX('DAY',START_DATE_CM,1);

    call symput("CD3PM",put(CD3PM,DATE9.));
    call symput("CD2CM",put(CD2CM,DATE9.));
RUN;

%PUT &amp;amp;CD2CM;
%PUT &amp;amp;CD3PM;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Oct 2020 00:40:12 GMT</pubDate>
    <dc:creator>CurtisMackWSIPP</dc:creator>
    <dc:date>2020-10-02T00:40:12Z</dc:date>
    <item>
      <title>Can this be re-written using a data step only?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688403#M209116</link>
      <description>&lt;P&gt;I have written some code, and it works just fine.&amp;nbsp; I am always trying to learn other ways to do the same thing. In this case, instead of relying on PROC SQL and into: for the macro variable I would like to learn another way to accomplish this and possibly lessen the number of lines of code I am writing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I currently have:&amp;nbsp; CD=CalendarDay, PM=PriorMonth, CM=CurrentMonth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA DATES;
    FORMAT START_DATE_PM DATE9.;
    FORMAT CD3PM DATE9.;
    FORMAT START_DATE_CM DATE9.;
    FORMAT CD2CM DATE9.;
    START_DATE_PM = INTNX('MONTH',TODAY(),-1,'B');
    CD3PM = INTNX('DAY',START_DATE_PM,2);
    START_DATE_CM = INTNX('MONTH',TODAY(),0,'B');
    CD2CM = INTNX('DAY',START_DATE_CM,1);
RUN;

PROC SQL NOPRINT;
    SELECT  CD2CM, CD3PM
    INTO:   CD2CM,
        :   CD3PM
    FROM    DATES;
QUIT;
%PUT &amp;amp;CD2CM;
%PUT &amp;amp;CD3PM;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Oct 2020 23:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688403#M209116</guid>
      <dc:creator>SAS_ACE</dc:creator>
      <dc:date>2020-10-01T23:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can this be re-written using a data step only?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688405#M209117</link>
      <description>&lt;P&gt;I'm not understanding your question.&amp;nbsp; What do you want to do with the values of&amp;nbsp;CD2CM &amp;amp; CD3PM?&lt;/P&gt;
&lt;P&gt;If you just want to set those macro variables in a more straight forward way, you could do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let START_DATE_PM = %sysfunc(INTNX(MONTH,%sysfunc(TODAY()),-1,B));
%let CD3PM %sysfunc(putn(%sysfunc(INTNX(DAY,&amp;amp;START_DATE_PM,2)),DATE9.));
%let START_DATE_CM = %sysfunc(INTNX(MONTH,%sysfunc(TODAY()),0,B));
%let CD2CM %sysfunc(putn(%sysfunc(INTNX(DAY,&amp;amp;START_DATE_CM,1)),DATE9.));

%PUT &amp;amp;CD2CM;
%PUT &amp;amp;CD3PM;&lt;/CODE&gt;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Oct 2020 00:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688405#M209117</guid>
      <dc:creator>CurtisMackWSIPP</dc:creator>
      <dc:date>2020-10-02T00:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can this be re-written using a data step only?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688406#M209118</link>
      <description>&lt;P&gt;How about this? CALL SYMPUTX will do what you need.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA DATES;
    FORMAT START_DATE_PM DATE9.;
    FORMAT CD3PM DATE9.;
    FORMAT START_DATE_CM DATE9.;
    FORMAT CD2CM DATE9.;
    START_DATE_PM = INTNX('MONTH',TODAY(),-1,'B');
    CD3PM = INTNX('DAY',START_DATE_PM,2);
    START_DATE_CM = INTNX('MONTH',TODAY(),0,'B');
    CD2CM = INTNX('DAY',START_DATE_CM,1);
    call symputx ('CD3PM', CD3PM);
    call symputx ('CD2CM', CD2CM);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;BTW, coding in mixed case is far easier to read.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 00:29:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688406#M209118</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-10-02T00:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can this be re-written using a data step only?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688407#M209119</link>
      <description>SASKiwi,&lt;BR /&gt;&lt;BR /&gt;That is close, but when i do the %PUT on the macro variables they return days from 1960. How can we change to show in DATE9. ?</description>
      <pubDate>Fri, 02 Oct 2020 00:37:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688407#M209119</guid>
      <dc:creator>SAS_ACE</dc:creator>
      <dc:date>2020-10-02T00:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can this be re-written using a data step only?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688408#M209120</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA DATES;
    START_DATE_PM = INTNX('MONTH',TODAY(),-1,'B');
    CD3PM = INTNX('DAY',START_DATE_PM,2);
    START_DATE_CM = INTNX('MONTH',TODAY(),0,'B');
    CD2CM = INTNX('DAY',START_DATE_CM,1);

    call symput("CD3PM",put(CD3PM,DATE9.));
    call symput("CD2CM",put(CD2CM,DATE9.));
RUN;

%PUT &amp;amp;CD2CM;
%PUT &amp;amp;CD3PM;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Oct 2020 00:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688408#M209120</guid>
      <dc:creator>CurtisMackWSIPP</dc:creator>
      <dc:date>2020-10-02T00:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can this be re-written using a data step only?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688409#M209121</link>
      <description>&lt;P&gt;Ah, very nice.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 00:41:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688409#M209121</guid>
      <dc:creator>SAS_ACE</dc:creator>
      <dc:date>2020-10-02T00:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can this be re-written using a data step only?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688411#M209122</link>
      <description>Hi Curtis. This is definitely the "shortest" way. Thank you for looking at this.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Oct 2020 00:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-this-be-re-written-using-a-data-step-only/m-p/688411#M209122</guid>
      <dc:creator>SAS_ACE</dc:creator>
      <dc:date>2020-10-02T00:42:31Z</dc:date>
    </item>
  </channel>
</rss>

