<?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 Labeling Macro Help in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565326#M75020</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble labeling all of a certain type of variable with the same label.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code that I have is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro Label(Exp);
data sub.master_dataset053019;
set sub.master_dataset053019;

%do i=1 %to %sysfunc(countw(&amp;amp;exp));
    %let thisexp=%scan(&amp;amp;exp,&amp;amp;i,%str( ));
	label I_PostResYr_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr1st6mo_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr1st6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr2nd6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr2nd6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr1stQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr1stQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr2ndQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr2ndQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr3rdQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr3rdQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr4thQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr4thQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr1stT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr1stT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr2ndT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr2ndT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr3rdT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr3rdT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	%end ;
run;
%mend;

%label(house consume durable Trans health Insure Loan Tax Educa Gift Enter REcre FinPlan Legala AlcSpend ST2DENOM2 ST2DENOM3 ExpendTl FinPlSav IncomeTL ST2Oblig);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I an receiving 1787 errors indicating that my text is too long, but it doesnt seem to pass the 256 characters in the label?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1          ;*';*";*/;quit;run;
ERROR: The text expression length (65580) exceeds maximum length (65534). The text expression has been truncated to 65534 
       characters.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am at a loss. Could I be using the macro inappropriately? I have used almost the same macro more than once and it worked flawlessly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2019 17:13:12 GMT</pubDate>
    <dc:creator>joebacon</dc:creator>
    <dc:date>2019-06-11T17:13:12Z</dc:date>
    <item>
      <title>Labeling Macro Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565326#M75020</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble labeling all of a certain type of variable with the same label.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code that I have is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro Label(Exp);
data sub.master_dataset053019;
set sub.master_dataset053019;

%do i=1 %to %sysfunc(countw(&amp;amp;exp));
    %let thisexp=%scan(&amp;amp;exp,&amp;amp;i,%str( ));
	label I_PostResYr_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr1st6mo_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr1st6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr2nd6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr2nd6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr1stQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr1stQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr2ndQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr2ndQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr3rdQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr3rdQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr4thQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr4thQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr1stT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr1stT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr2ndT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr2ndT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr3rdT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr3rdT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	%end ;
run;
%mend;

%label(house consume durable Trans health Insure Loan Tax Educa Gift Enter REcre FinPlan Legala AlcSpend ST2DENOM2 ST2DENOM3 ExpendTl FinPlSav IncomeTL ST2Oblig);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I an receiving 1787 errors indicating that my text is too long, but it doesnt seem to pass the 256 characters in the label?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1          ;*';*";*/;quit;run;
ERROR: The text expression length (65580) exceeds maximum length (65534). The text expression has been truncated to 65534 
       characters.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am at a loss. Could I be using the macro inappropriately? I have used almost the same macro more than once and it worked flawlessly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 17:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565326#M75020</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2019-06-11T17:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling Macro Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565333#M75021</link>
      <description>&lt;P&gt;If this is supposed to be a block of label instructions:&lt;/P&gt;
&lt;PRE&gt;	label I_PostResYr_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr1st6mo_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr1st6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr2nd6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr2nd6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr1stQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr1stQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr2ndQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr2ndQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr3rdQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr3rdQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr4thQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr4thQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr1stT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr1stT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr2ndT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr2ndT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PreResYr3rdT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
	I_PostResYr3rdT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs";
&lt;/PRE&gt;
&lt;P&gt;You have too many semi colons.&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;	label 
      I_PostResYr_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr1st6mo_&amp;amp;thisExp = "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PostResYr1st6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr2nd6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PostResYr2nd6mo_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr1stQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PostResYr1stQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr2ndQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PostResYr2ndQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr3rdQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PostResYr3rdQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr4thQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PostResYr4thQ_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr1stT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PostResYr1stT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr2ndT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PostResYr2ndT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PreResYr3rdT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   	I_PostResYr3rdT_&amp;amp;thisExp= "+1 to all I_ Variables for 0's in prop/Logs"
   ;
&lt;/PRE&gt;
&lt;P&gt;Other than the first line with the actual LABEL statement SAS thought you were attempting to assign the string as the value of the variable, NOT a label.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW you don't need the %str() in this:&lt;/P&gt;
&lt;P&gt;%let thisexp&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token macroname"&gt;%scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;exp&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;i&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token macrostatement"&gt;%str&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;as a blank is a default parameter for %scan. Use&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;%let thisexp&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token macroname"&gt;%scan&lt;/SPAN&gt;(&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;exp&lt;/SPAN&gt;, &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;I );&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;The error of exceeding character length probably means you have gotten into an unstable state, probably due to a mismatched quote or () somewhere. Save the code and restart SAS.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 17:41:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565333#M75021</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-11T17:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling Macro Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565338#M75023</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;As always, you are a wizard. I had tried an iteration without all the semi-colons and assumed I was incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Saving and restarting did the trick. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, good to note about blank being the default parameter for scan. I appreciate you taking your time to help me!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 17:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565338#M75023</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2019-06-11T17:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling Macro Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565351#M75025</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/241893"&gt;@joebacon&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the macro adds or modifies variable &lt;EM&gt;labels&lt;/EM&gt;, but doesn't change variable &lt;EM&gt;values&lt;/EM&gt;&amp;nbsp;(or the structure of the dataset), there is no need to read and write the whole (possibly huge) dataset using a DATA step. &lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=n0ahh0eqtadmp3n1uwv55i2gyxiz.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;PROC DATASETS&lt;/A&gt; could do this much more efficiently:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=sub nolist;
modify master_dataset053019;
label ...
      ...
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the LABEL statement use the same syntax as you did in the DATA step (after the correction). Also the macro logic remains unchanged.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 18:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565351#M75025</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-06-11T18:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling Macro Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565359#M75027</link>
      <description>&lt;P&gt;Man, I have been on many forums and this one is the only one that the individuals truly go out of their way to help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much! Computationally, that is way faster. A great suggestion that I would have never even attempted.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 18:54:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565359#M75027</guid>
      <dc:creator>joebacon</dc:creator>
      <dc:date>2019-06-11T18:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Labeling Macro Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565404#M75035</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/241893"&gt;@joebacon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Man, I have been on many forums and this one is the only one that the individuals truly go out of their way to help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much! Computationally, that is way faster. A great suggestion that I would have never even attempted.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A data step always loads all of the records into the data vector and then writes them to the output data set&amp;nbsp;and that can take time that is noticeable when the data set is even only moderate in size.&lt;/P&gt;
&lt;P&gt;The Proc Datasets is writing to the header information of the file so even when a data set is many times larger the time involved is almost the same,&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 21:03:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Labeling-Macro-Help/m-p/565404#M75035</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-11T21:03:42Z</dc:date>
    </item>
  </channel>
</rss>

