<?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 SAS Macro with Title Statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-with-Title-Statement/m-p/353960#M82694</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a student in a beginner's class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been asked to create SAS code to generate the following output using SAS macros:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8573i4807E5243DDFFB43/image-size/original?v=1.0&amp;amp;px=-1" alt="Capture.JPG" title="Capture.JPG" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have so far as my output:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8574i13EFFAF36866355A/image-size/original?v=1.0&amp;amp;px=-1" alt="Capture.JPG" title="Capture.JPG" border="0" /&gt;&lt;/P&gt;&lt;P&gt;The problem I am facing is that I cannot get the date to insert correctly.&lt;/P&gt;&lt;P&gt;My guidelines provided are as follows:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; line-height: 115%;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; i)&amp;nbsp; Use the %Let SAS Macro with a SAS Macro name. &amp;nbsp;(You will not need more than 3 %let statements.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; line-height: 115%;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ii)&amp;nbsp; Use the system generated SAS Macros for your Day and Date in title&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; line-height: 115%;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iii)&amp;nbsp; To create both titles on same output (second table), you will have to use Title1 and Title2 statements.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Let BeginDt = DATEJUL( yyddd );
%Let Enddt = DATEJUL( yyddd );
%Let TitleYr = DATEJUL( yyddd );
proc print data=wine.winedata noobs label;
	where origin='France';
	var Varietal Campaign past_peak cases_purchased;
	title1 'France Monthly Sales by Product';
	title2 "Report Issued on &amp;amp;titleyr";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 8pt; line-height: 115%;"&gt;Any ideas on what I am doing wrong that the date will not appear correctly?&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; line-height: 115%;"&gt;Thank you, in advance!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Apr 2017 02:33:56 GMT</pubDate>
    <dc:creator>bldudley</dc:creator>
    <dc:date>2017-04-27T02:33:56Z</dc:date>
    <item>
      <title>SAS Macro with Title Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-with-Title-Statement/m-p/353960#M82694</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a student in a beginner's class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been asked to create SAS code to generate the following output using SAS macros:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8573i4807E5243DDFFB43/image-size/original?v=1.0&amp;amp;px=-1" alt="Capture.JPG" title="Capture.JPG" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have so far as my output:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8574i13EFFAF36866355A/image-size/original?v=1.0&amp;amp;px=-1" alt="Capture.JPG" title="Capture.JPG" border="0" /&gt;&lt;/P&gt;&lt;P&gt;The problem I am facing is that I cannot get the date to insert correctly.&lt;/P&gt;&lt;P&gt;My guidelines provided are as follows:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; line-height: 115%;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; i)&amp;nbsp; Use the %Let SAS Macro with a SAS Macro name. &amp;nbsp;(You will not need more than 3 %let statements.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; line-height: 115%;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ii)&amp;nbsp; Use the system generated SAS Macros for your Day and Date in title&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; line-height: 115%;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iii)&amp;nbsp; To create both titles on same output (second table), you will have to use Title1 and Title2 statements.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Let BeginDt = DATEJUL( yyddd );
%Let Enddt = DATEJUL( yyddd );
%Let TitleYr = DATEJUL( yyddd );
proc print data=wine.winedata noobs label;
	where origin='France';
	var Varietal Campaign past_peak cases_purchased;
	title1 'France Monthly Sales by Product';
	title2 "Report Issued on &amp;amp;titleyr";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 8pt; line-height: 115%;"&gt;Any ideas on what I am doing wrong that the date will not appear correctly?&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8.0pt; line-height: 115%;"&gt;Thank you, in advance!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 02:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-with-Title-Statement/m-p/353960#M82694</guid>
      <dc:creator>bldudley</dc:creator>
      <dc:date>2017-04-27T02:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro with Title Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-with-Title-Statement/m-p/353965#M82698</link>
      <description>&lt;P&gt;A couple of concepts to add ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, the part of the title that gets replaced with the date is actually two pieces. &amp;nbsp;The day of the week is separate from the date itself. &amp;nbsp;SAS already supplies a macro variable with the date: &amp;nbsp;&amp;amp;sysdate&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So your title will include&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;title2 "Report Issued on ???? &amp;amp;sysdate";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, to utilize most functions in macro language, you have to run them through the macro function %SYSFUNC. &amp;nbsp;So you could be starting with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let day = %sysfunc(putn("&amp;amp;sysdate"d, weekdate9));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are probably other ways to get there (and this is untested).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, when using a date format such as weekdate9, the result is centered. &amp;nbsp;To get rid of leading and trailing blanks, you could simply add:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let day = &amp;amp;day;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then the title becomes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;title2 "Report for &amp;amp;day &amp;amp;sysdate";&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 03:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-with-Title-Statement/m-p/353965#M82698</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-27T03:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro with Title Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-with-Title-Statement/m-p/353976#M82705</link>
      <description>&lt;P&gt;Are those the exact instructions provided? TBH they look incorrect.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 04:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-with-Title-Statement/m-p/353976#M82705</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-27T04:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro with Title Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-with-Title-Statement/m-p/354091#M82770</link>
      <description>&lt;P&gt;Good news, now that I had a chance to check my code.&amp;nbsp; There are two relevant automatic macro variables available.&amp;nbsp; No calculations are needed, just:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;title2 "Report for &amp;amp;sysday &amp;amp;sysdate";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For extra credit, take a look at &amp;amp;sysdate9 vs. &amp;amp;sysdate.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 12:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-with-Title-Statement/m-p/354091#M82770</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-27T12:45:23Z</dc:date>
    </item>
  </channel>
</rss>

