<?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: tabs and or spaces not properly aligned in the log when calling macros via %include statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574895#M162513</link>
    <description>thanks - I replaced tabs with spaces in the macro file and this has resolved the problem.</description>
    <pubDate>Fri, 19 Jul 2019 09:58:44 GMT</pubDate>
    <dc:creator>Nahidul</dc:creator>
    <dc:date>2019-07-19T09:58:44Z</dc:date>
    <item>
      <title>tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574637#M162419</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Long term reader first time poster here in this wonderful community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the issue I'm having is that when I call a macro from another program using the %include statement and run the macro which will print using the %put statement, the output I get does not appear aligned properly, see below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;-------------------------------------
-  Values for Current Month     -
-Year    (YYYY)   = 2019   -
-Month   (MM)  = 07     -
-Month &amp;amp; Year  (YYYYMM) = 201907 -
-Month &amp;amp; Year  (YYYY-MM) = 2019-07-
-Month &amp;amp; Year  (MMMYY)  = JUL19  -
-------------------------------------&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but when running the macro directly from the file containing the macro, it is properly aligned, see below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;-------------------------------------
-      Values for Current Month     -
-Year          (YYYY)      = 2019   -
-Month         (MM)        = 07     -
-Month &amp;amp; Year  (YYYYMM)    = 201907 -
-Month &amp;amp; Year  (YYYY-MM)   = 2019-07-
-Month &amp;amp; Year  (MMMYY)     = JUL19  -
-------------------------------------&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to set up my macros in a toolbox location which is called using the %include statement in other programs but not suffer from the issue of losing spaces/tabs in the log when printing, can anyone provide some help with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;macro code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro date_list(offset);
	%do i = 0 %to 11;
		%global yyyymm&amp;amp;i. mmmyy&amp;amp;i. yyyy_mm&amp;amp;i. yyyy&amp;amp;i. mm&amp;amp;i.;
			%let yyyy&amp;amp;i. 	= %sysfunc(intnx(month,%sysfunc(today()),-&amp;amp;offset.-&amp;amp;i.),year.);
			%let mm&amp;amp;i.	 	= %sysfunc(putn(%sysfunc(intnx(month,%sysfunc(today()),-&amp;amp;offset.-&amp;amp;i.),month.),z2.));
			%let yyyymm&amp;amp;i. 	= %sysfunc(intnx(month,%sysfunc(today()),-&amp;amp;offset.-&amp;amp;i.),yymmn6.);
			%let mmmyy&amp;amp;i. 	= %sysfunc(intnx(month,%sysfunc(today()),-&amp;amp;offset.-&amp;amp;i.),monyy5.);
			%let yyyy_mm&amp;amp;i. = %sysfunc(intnx(month,%sysfunc(today()),-&amp;amp;offset.-&amp;amp;i.),yymmd.);
		%end;

	data dates;
		do i = 0 to 11;
			yyyy	= put(symget(cats('yyyy',i)),$6.);
			mm		= put(symget(cats('mm',i)),$2.);
			yyyymm 	= put(symget(cats('yyyymm',i)),$6.);
			mmmyy 	= put(symget(cats('mmmyy',i)),$5.);
			yyyy_mm = put(symget(cats('yyyy_mm',i)),$7.);
		output;
		end;
	run;

	proc print data = dates;
	run;

	%put -------------------------------------;
	%put -		Values for Current Month     -;
	%put -Year 			(YYYY) 		= &amp;amp;yyyy0.   -;
	%put -Month 		(MM)		= &amp;amp;mm0.     -;
	%put -Month &amp;amp; Year 	(YYYYMM)	= &amp;amp;yyyymm0. -;
	%put -Month &amp;amp; Year 	(YYYY-MM)	= &amp;amp;yyyy_mm0.-;
	%put -Month &amp;amp; Year 	(MMMYY)		= &amp;amp;mmmyy0.  -;
	%put -------------------------------------;
%mend;

/*options nomprint nomlogic;*/
%date_list(0);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Jul 2019 15:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574637#M162419</guid>
      <dc:creator>Nahidul</dc:creator>
      <dc:date>2019-07-18T15:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574651#M162426</link>
      <description>&lt;P&gt;What does the code for that macro look like?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 15:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574651#M162426</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-07-18T15:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574653#M162428</link>
      <description>Its included in my description. if you copy the date_list macro and run it directly, the output is okay. if you call it into another program using the %include statement, the put statement at the bottom goes wild</description>
      <pubDate>Thu, 18 Jul 2019 15:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574653#M162428</guid>
      <dc:creator>Nahidul</dc:creator>
      <dc:date>2019-07-18T15:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574661#M162433</link>
      <description>Can you run both of those cases back to back and post the full log?</description>
      <pubDate>Thu, 18 Jul 2019 16:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574661#M162433</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-18T16:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574665#M162435</link>
      <description>&lt;P&gt;TAB characters are notable unreliable. Please look at your post and note that even in the code you posted&amp;nbsp;that the different default width of tabs as treated by the forum make your example not align either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this were my project I would likely use the information in a&amp;nbsp; separate data _null_ step to use column controls with PUT to place things where I wanted. Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
put "---------------------------------------";
put "-       Values for Current Month"                    @39"-";
put "-Year"          @16"(YYYY)"    @26"=" @31"&amp;amp;yyyy0."   @39"-";
put "-Month"         @16"(MM)"      @26"=" @31"&amp;amp;mm0."     @39"-";
put "-Month &amp;amp; Year"  @16"(YYYYMM)"  @26"=" @31"&amp;amp;yyyymm0." @39"-";
put "-Month &amp;amp; Year"  @16"(YYYY-MM)" @26"=" @31"&amp;amp;yyyy_mm0."@39"-";
put "-Month &amp;amp; Year"  @16"(MMMYY)"   @26"=" @31"&amp;amp;mmmyy0."  @39"-";
put "---------------------------------------";
run;
&lt;/PRE&gt;
&lt;P&gt;That may be a tad of overkill for controlling where each column appears but if you need to change layout it provides a good example of what might be needed.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 16:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574665#M162435</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-07-18T16:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574668#M162437</link>
      <description>&lt;P&gt;Why do your code files contain tabs to begin with?&lt;/P&gt;
&lt;P&gt;If you are using SAS to edit your code the various editors have options to replace tabs with spaces.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 16:25:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574668#M162437</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-18T16:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574675#M162440</link>
      <description>&lt;P&gt;If you open a text file in the program editor and submit the code then SAS will normally replace the tabs with spaces.&lt;/P&gt;
&lt;P&gt;If you %include the same file then the tabs are not replaced.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best solution is to not use tabs in your code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really must keep tabs in your code then perhaps you should add a step to pre-process the file and replace the tabs and %INCLUDE the fixed version.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp;
filename fixed temp;

data _null_;
 file code ;
 put 'data _null_; input; list;cards;'
   / 'This has a' '09'x 'tab character'
   /';'
 ;
run;


data _null_;
  infile code expandtabs;
  file fixed;
  input;
  put _infile_;
run;

%include code / source2 ;
%include fixed / source2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;383   %include code / source2 ;
NOTE: %INCLUDE (level 1) file CODE is file C:\...\#LN00067.
384  +data _null_; input; list;cards;

RULE:       ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+

385 CHAR    This has a.tab character
    ZONE    56672667260766266676676722222222222222222222222222222222222222222222222222222222
    NUMR    48930813019412038121345200000000000000000000000000000000000000000000000000000000
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


386  +;
NOTE: %INCLUDE (level 1) ending.
387   %include fixed / source2;
NOTE: %INCLUDE (level 1) file FIXED is file C:\...\#LN00068.
388  +data _null_; input; list;cards;

RULE:       ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+
389         This has a      tab character
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


390  +;
NOTE: %INCLUDE (level 1) ending.
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 17:00:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574675#M162440</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-18T17:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574895#M162513</link>
      <description>thanks - I replaced tabs with spaces in the macro file and this has resolved the problem.</description>
      <pubDate>Fri, 19 Jul 2019 09:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574895#M162513</guid>
      <dc:creator>Nahidul</dc:creator>
      <dc:date>2019-07-19T09:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574896#M162514</link>
      <description>I use tabs to help me keep my code easy to read and manage, not everyone's cup of tea I know but it helps me.</description>
      <pubDate>Fri, 19 Jul 2019 10:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574896#M162514</guid>
      <dc:creator>Nahidul</dc:creator>
      <dc:date>2019-07-19T10:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: tabs and or spaces not properly aligned in the log when calling macros via %include statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574944#M162521</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/129846"&gt;@Nahidul&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;thanks - I replaced tabs with spaces in the macro file and this has resolved the problem.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Make sure that you don't have tabs inside of your quoted strings (ore macro variable values) and the difference in spacing shouldn't impact your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It can be a pain since some old time editors used to replace any spaces they could with tabs. I think the idea was to save a few bytes of disk space.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 13:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/tabs-and-or-spaces-not-properly-aligned-in-the-log-when-calling/m-p/574944#M162521</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-19T13:51:17Z</dc:date>
    </item>
  </channel>
</rss>

