<?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: dynamic ods body filename - monthly - unable to assign variable in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5913#M2391</link>
    <description>Papers are selected for SAS Global Forum to cover the range from beginner to advanced.  Often, the beginner presentations are among the best attended at the conference, and planning, and arriving in good time are good strategies for ensuring you get into the room.  (The fire marshalls strictly enforce room occupancies, so tucking yourself into a corner or on the floor in the aisle will not be permitted.)  The Hands On Workshops are especially likely to turn away attendees.  (Of course everything is bigger in Texas, so perhaps that won't be a problem in 2008 &lt;GRIN&gt; )&lt;BR /&gt;
&lt;BR /&gt;
Each conference usually includes three days of SAS public training before commencement and often now includes a number of days afterwards.  All levels of knowledge are catered for, although the products presented are necessarily restricted.&lt;BR /&gt;
&lt;BR /&gt;
I have had the pleasure of being in Cynthia's classes a number of times; indeed she ignited the fire for ODS in me some years ago.  At the very least, you should enquire about and try to attend the one-day Geekfest if it is held.  The insights into what is under development for ODS, doing the impossible with ODS and why ODS isn't quite doing what you wanted it to... yet: are well worth arriving a day or two early.  Eric's enthusiasm about templates is infectious.&lt;BR /&gt;
&lt;BR /&gt;
As Cynthia said, Macros are always well covered, if you look up the paper list for SGF07 you'll see a number of hits.  Just remember Zender Rule 1: always start with working and tested SAS code.&lt;BR /&gt;
&lt;BR /&gt;
Kind regards&lt;BR /&gt;
&lt;BR /&gt;
David&lt;/GRIN&gt;</description>
    <pubDate>Tue, 18 Dec 2007 23:32:44 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-12-18T23:32:44Z</dc:date>
    <item>
      <title>dynamic ods body filename - monthly - unable to assign variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5906#M2384</link>
      <description>What Im trying to do is fairly simple, running a monthly&lt;BR /&gt;
batch sas program to save html output into files named dynamically the&lt;BR /&gt;
name of the previous month/year&lt;BR /&gt;
&lt;BR /&gt;
so here is the log of the code I write to set a variable with&lt;BR /&gt;
the previous month ( wanted to achieve something like 012007 for&lt;BR /&gt;
january 2007 for example ) :&lt;BR /&gt;
&lt;BR /&gt;
14         data _null_; &lt;BR /&gt;
15          month=month( today() - day(today()) ); &lt;BR /&gt;
16          year=year( today() - day(today()) ); &lt;BR /&gt;
17          %let monthYearChar=month || year; &lt;BR /&gt;
18          call symput('monthYear',&amp;amp;monthYearChar); &lt;BR /&gt;
19          %put ( "_&amp;amp;monthYear._"); &lt;BR /&gt;
( "_          11        2007_") &lt;BR /&gt;
20         run; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
see that : ( "_          11        2007_") &lt;BR /&gt;
its like it is inserting leading spaces to month and year when I concatenate them&lt;BR /&gt;
&lt;BR /&gt;
anyone as a better idea on how to do this betteR ?&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance&lt;BR /&gt;
Yannick</description>
      <pubDate>Tue, 18 Dec 2007 01:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5906#M2384</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-18T01:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic ods body filename - monthly - unable to assign variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5907#M2385</link>
      <description>Your %Let and %Put statements should not be inside the data step.&lt;BR /&gt;
&lt;BR /&gt;
%Let is a global statement and functions outside the data step environment.  Your %Put is also global, but the value you set in the macro symbol table will not be available until after the data step has executed, so the value at line 19 is not from that data step, but from a previous iteration.&lt;BR /&gt;
&lt;BR /&gt;
Subtracting days from month and year values is prone to problems, especially around this time when a January run may not correctly specify the December month and year.  Instead, use a time interval function as the code I provide below does and you will then get the right values.&lt;BR /&gt;
&lt;BR /&gt;
14         Data _NULL_;&lt;BR /&gt;
15           LASTMONTH = IntNx( 'Month', Today(), -1, "e");&lt;BR /&gt;
16           HTMLNAME = "_ " || Put( LASTMONTH, Month2.) || " " || Put( LASTMONTH, Year4.) || " _";&lt;BR /&gt;
17           Call Symput( 'MonthYear', HTMLNAME);&lt;BR /&gt;
18         Run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
      &lt;BR /&gt;
&lt;BR /&gt;
19         &lt;BR /&gt;
20         %Put &amp;amp;MonthYear.;&lt;BR /&gt;
_ 11 2007 _&lt;BR /&gt;
&lt;BR /&gt;
Kind regards&lt;BR /&gt;
&lt;BR /&gt;
David

P.S.  Including spaces in path and file names is asking for trouble in Windows.  I would remove the spacing from the name.&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: dkvj</description>
      <pubDate>Tue, 18 Dec 2007 01:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5907#M2385</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-18T01:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic ods body filename - monthly - unable to assign variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5908#M2386</link>
      <description>Hi:&lt;BR /&gt;
  There is a rule in Macro processing that if you create macro variables inside a data step program, you cannot reference those macro variables (and get a correct result) until after a step boundary for the data step program. (As David has already explained...)&lt;BR /&gt;
   &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 18 Dec 2007 05:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5908#M2386</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-12-18T05:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic ods body filename - monthly - unable to assign variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5909#M2387</link>
      <description>David and Cynthia have explained some risks of the original approach and a better way of dealing with the information through the data step. &lt;BR /&gt;
&lt;BR /&gt;
Having some experience of implementing batch processes with similar need of last month's date, I can offer a reduced solution that appears almost intuitive.&lt;BR /&gt;
&lt;BR /&gt;
If you seek a simple statement that delivers "last month" in some format, consider these alternatives all of which use &lt;BR /&gt;
the "interval next" function, INTNX() applied to &lt;BR /&gt;
the automatic macro variable &amp;amp;sysDate (which provides the SAS session start date - a date you can usually rely on in batch processing).&lt;BR /&gt;
&lt;BR /&gt;
What makes the following alternatives different, is just the format of the date info:&lt;BR /&gt;
&lt;BR /&gt;
e.g. NOV2007&lt;BR /&gt;
%let LastMon = %sysfunc( intnx( month "&amp;amp;sysdate"d, -1 ), monyy7 );&lt;BR /&gt;
&lt;BR /&gt;
e.g. NOV07&lt;BR /&gt;
%let LastMon = %sysfunc( intnx( month "&amp;amp;sysdate"d, -1 ), monyy5 );&lt;BR /&gt;
&lt;BR /&gt;
e.g. 11-2007&lt;BR /&gt;
%let LastMon = %sysfunc( intnx( month "&amp;amp;sysdate"d, -1 ), mmyyD7 );&lt;BR /&gt;
&lt;BR /&gt;
e.g. 2007.11&lt;BR /&gt;
%let LastMon = %sysfunc( intnx( month "&amp;amp;sysdate"d, -1 ), yymmP6 );&lt;BR /&gt;
&lt;BR /&gt;
e.g. 0711&lt;BR /&gt;
%let LastMon = %sysfunc( intnx( month "&amp;amp;sysdate"d, -1 ), yymmD4 );&lt;BR /&gt;
&lt;BR /&gt;
e.g. 30NOV2007 &lt;BR /&gt;
%let LastMon = %sysfunc( intnx( month "&amp;amp;sysdate"d, -1, e ), date9 );&lt;BR /&gt;
&lt;BR /&gt;
e.g. 20071130 &lt;BR /&gt;
%let LastMon = %sysfunc( intnx( month "&amp;amp;sysdate"d, -1, e ), yymmddN8 );&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
There are many more date formats: look for Date and Time in Formats by Category in SAS Online-Doc at &lt;A href="http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a001263753.htm" target="_blank"&gt;http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a001263753.htm&lt;/A&gt;.&lt;BR /&gt;
&lt;BR /&gt;
&amp;amp;SYSDATE is described in the Macro Language Dictionary at &lt;A href="http://support.sas.com/onlinedoc/913/getDoc/en/mcrolref.hlp/a000489463.htm" target="_blank"&gt;http://support.sas.com/onlinedoc/913/getDoc/en/mcrolref.hlp/a000489463.htm&lt;/A&gt;.&lt;BR /&gt;
&lt;BR /&gt;
For description of function INTNX(), see &lt;A href="http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000212700.htm" target="_blank"&gt;http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000212700.htm&lt;/A&gt;.&lt;BR /&gt;
&lt;BR /&gt;
For invoking base SAS functions %SYSFUNC() is described at &lt;A href="http://support.sas.com/onlinedoc/913/getDoc/en/mcrolref.hlp/z3514sysfunc.htm" target="_blank"&gt;http://support.sas.com/onlinedoc/913/getDoc/en/mcrolref.hlp/z3514sysfunc.htm&lt;/A&gt;.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The most complete list of formats can be found in the internal dictionary table of formats which can be used as SAS System data set  SASHELP.VFORMATS.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Seasons Greetings&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Tue, 18 Dec 2007 10:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5909#M2387</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-18T10:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic ods body filename - monthly - unable to assign variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5910#M2388</link>
      <description>Thank you, it as been very helpfull&lt;BR /&gt;
do you recommend books or training to learn about these basic sas techniques ?&lt;BR /&gt;
&lt;BR /&gt;
I wish there will be usefull presentations on basic sas stuff at next SUGI in texas&lt;BR /&gt;
where I may attend this spring&lt;BR /&gt;
&lt;BR /&gt;
Yannick</description>
      <pubDate>Tue, 18 Dec 2007 15:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5910#M2388</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-18T15:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic ods body filename - monthly - unable to assign variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5911#M2389</link>
      <description>hire a good consultant &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
P.S.&lt;BR /&gt;
and do come to San Antonio for SAS Global Forum (March 16-19, 2008) where the author is presenting in the section "Foundations and Fundamentals", a tutorial titled &lt;I&gt;Add SAS(r) Macros to Your Programming Skills: Achieve More, Write Less Code &lt;/I&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
PeterC

Message was edited by: Peter_c</description>
      <pubDate>Tue, 18 Dec 2007 16:14:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5911#M2389</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-18T16:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic ods body filename - monthly - unable to assign variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5912#M2390</link>
      <description>Hi:&lt;BR /&gt;
  The SAS Institute Macro classes are excellent. Many of these techniques for DATA step programming are basic programming techniques that are taught in the Programming I and Programming II classes (such as learning about functions, learning to read files, learning about conditional logic). &lt;BR /&gt;
&lt;BR /&gt;
There are generally several presentations at SGF that cover Macro processing from beginner level to advanced level. The SAS Macro facility is excellent. The SAS Publishing Books by Michelle Burlew and Art Carpenter on the SAS Macro facility are excellent. There is a wealth of information freely available on SAS Macro processing, if you do a Google search on the words:&lt;BR /&gt;
SAS Macro beginner&lt;BR /&gt;
...the first 2 hits are papers on SAS Macro facility for beginners.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 18 Dec 2007 20:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5912#M2390</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-12-18T20:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic ods body filename - monthly - unable to assign variable</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5913#M2391</link>
      <description>Papers are selected for SAS Global Forum to cover the range from beginner to advanced.  Often, the beginner presentations are among the best attended at the conference, and planning, and arriving in good time are good strategies for ensuring you get into the room.  (The fire marshalls strictly enforce room occupancies, so tucking yourself into a corner or on the floor in the aisle will not be permitted.)  The Hands On Workshops are especially likely to turn away attendees.  (Of course everything is bigger in Texas, so perhaps that won't be a problem in 2008 &lt;GRIN&gt; )&lt;BR /&gt;
&lt;BR /&gt;
Each conference usually includes three days of SAS public training before commencement and often now includes a number of days afterwards.  All levels of knowledge are catered for, although the products presented are necessarily restricted.&lt;BR /&gt;
&lt;BR /&gt;
I have had the pleasure of being in Cynthia's classes a number of times; indeed she ignited the fire for ODS in me some years ago.  At the very least, you should enquire about and try to attend the one-day Geekfest if it is held.  The insights into what is under development for ODS, doing the impossible with ODS and why ODS isn't quite doing what you wanted it to... yet: are well worth arriving a day or two early.  Eric's enthusiasm about templates is infectious.&lt;BR /&gt;
&lt;BR /&gt;
As Cynthia said, Macros are always well covered, if you look up the paper list for SGF07 you'll see a number of hits.  Just remember Zender Rule 1: always start with working and tested SAS code.&lt;BR /&gt;
&lt;BR /&gt;
Kind regards&lt;BR /&gt;
&lt;BR /&gt;
David&lt;/GRIN&gt;</description>
      <pubDate>Tue, 18 Dec 2007 23:32:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/dynamic-ods-body-filename-monthly-unable-to-assign-variable/m-p/5913#M2391</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-12-18T23:32:44Z</dc:date>
    </item>
  </channel>
</rss>

