<?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: cant we assign macro variables in positional/keyword parameters in macros? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462248#M117651</link>
    <description>&lt;P&gt;If i remove dot..it still having errors...&lt;/P&gt;&lt;P&gt;not able to reslove the macro variable &amp;amp;time ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;check below log..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;GOPTIONS ACCESSIBLE;&lt;BR /&gt;29 %macro x(dat,time,var1);&lt;BR /&gt;30 data &amp;amp;dat;&lt;BR /&gt;31 set summary_ANZSIC (where=( mdate= input(compress("&amp;amp;time"),10.)));&lt;BR /&gt;32 rename total_Tce = &amp;amp;var1_TCE;&lt;BR /&gt;33 rename weighted_PD = &amp;amp;var1_weightedPD;&lt;BR /&gt;34 rename wavgPD = &amp;amp;var1_wavgPD;&lt;BR /&gt;35 run;&lt;BR /&gt;36 %mend;&lt;BR /&gt;37 %x(a1,"&amp;amp;curr_date",curr);&lt;BR /&gt;NOTE 138-205: Line generated by the macro variable "TIME".&lt;BR /&gt;37 ""31MAR2018"&lt;BR /&gt;__&lt;BR /&gt;49&lt;BR /&gt;__&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space&lt;BR /&gt;between a quoted string and the succeeding identifier is recommended.&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, ), *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN,&lt;BR /&gt;CONTAINS, EQ, GE, GT, IN, IS, LE, LIKE, LT, NE, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;22: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, CUROBS, END, INDSNAME, KEY, KEYRESET, KEYS,&lt;BR /&gt;NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.&lt;BR /&gt;200: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;2 The SAS System 10:30 Tuesday, May 15, 2018&lt;/P&gt;&lt;P&gt;22: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 22-322: Expecting a name.&lt;BR /&gt;200: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;22: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 22-322: Expecting a name.&lt;BR /&gt;200: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;22: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 22-322: Expecting a name.&lt;BR /&gt;200: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;ERROR: Syntax error while parsing WHERE clause.&lt;/P&gt;</description>
    <pubDate>Tue, 15 May 2018 03:38:14 GMT</pubDate>
    <dc:creator>BaalaRaaji</dc:creator>
    <dc:date>2018-05-15T03:38:14Z</dc:date>
    <item>
      <title>cant we assign macro variables in positional/keyword parameters in macros?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462235#M117647</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below code that needs to run for each month/year/quartely end dates..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;set summary_A (where=( mdate= input(compress("&amp;amp;curr_date."),10.)));&lt;BR /&gt;rename total_Tce = Cur_TCE;&lt;BR /&gt;rename weighted_PD = Cur_weightedPD;&lt;BR /&gt;rename wavgPD = Cur_wavgPD;&lt;BR /&gt;run;&lt;BR /&gt;data b;&lt;BR /&gt;set summary_A1 (where=( mdate= input(compress("&amp;amp;last_yr_date."),10.)));&lt;BR /&gt;rename total_Tce = Pre_TCE;&lt;BR /&gt;rename weighted_PD = Pre_weightedPD;&lt;BR /&gt;rename wavgPD = Pre_wavgPD;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;More calaculations based on above variables...However i wanted to put in a single macro to call for all dates like below&lt;BR /&gt;but its not working&lt;/P&gt;&lt;P&gt;%macro x(dat,time,var1);&lt;BR /&gt;data &amp;amp;dat;&lt;BR /&gt;set summary_ANZSIC (where=( mdate= input(compress("&amp;amp;time."),10.)));&lt;BR /&gt;rename total_Tce = &amp;amp;var1_TCE;&lt;BR /&gt;rename weighted_PD = &amp;amp;var1_weightedPD;&lt;BR /&gt;rename wavgPD = &amp;amp;var1_wavgPD;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;BR /&gt;%x(a1,&amp;amp;curr_date.,currm);&lt;BR /&gt;%x(a2,&amp;amp;prev_date. ,prevrm);&lt;BR /&gt;%x(a3,&amp;amp;last_yr_date.,lasty);&lt;BR /&gt;%x(a4,&amp;amp;firstq.,firstq);&lt;BR /&gt;%x(a5,&amp;amp;secq.,secq);&lt;BR /&gt;%x(a6,&amp;amp;thirdq.,thirdq);&lt;BR /&gt;%x(a7,&amp;amp;fourthq.,fourthq);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help much appreciated..thanks&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 01:05:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462235#M117647</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2018-05-15T01:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: cant we assign macro variables in positional/keyword parameters in macros?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462236#M117648</link>
      <description>&lt;P&gt;In your macro calls, you add a dot:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;amp;curr_date. instead of &amp;amp;curr_date&lt;/P&gt;
&lt;P&gt;&amp;amp;prev_date. instead of &amp;amp;prev_date&lt;/P&gt;
&lt;P&gt;&amp;amp;fourthq. instead of &amp;amp;fourthq&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have any idea why you do that and why you would use a dot?&amp;nbsp; There are several places in your macro where a dot is needed, but isn't there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more help than that, you might have to say more than "it's not working".&amp;nbsp; What type of errors are you getting?&amp;nbsp; What needs to be fixed?&amp;nbsp; You may need to run the macro with OPTIONS MPRINT turned on, and post the log.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 01:54:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462236#M117648</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-15T01:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: cant we assign macro variables in positional/keyword parameters in macros?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462248#M117651</link>
      <description>&lt;P&gt;If i remove dot..it still having errors...&lt;/P&gt;&lt;P&gt;not able to reslove the macro variable &amp;amp;time ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;check below log..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;GOPTIONS ACCESSIBLE;&lt;BR /&gt;29 %macro x(dat,time,var1);&lt;BR /&gt;30 data &amp;amp;dat;&lt;BR /&gt;31 set summary_ANZSIC (where=( mdate= input(compress("&amp;amp;time"),10.)));&lt;BR /&gt;32 rename total_Tce = &amp;amp;var1_TCE;&lt;BR /&gt;33 rename weighted_PD = &amp;amp;var1_weightedPD;&lt;BR /&gt;34 rename wavgPD = &amp;amp;var1_wavgPD;&lt;BR /&gt;35 run;&lt;BR /&gt;36 %mend;&lt;BR /&gt;37 %x(a1,"&amp;amp;curr_date",curr);&lt;BR /&gt;NOTE 138-205: Line generated by the macro variable "TIME".&lt;BR /&gt;37 ""31MAR2018"&lt;BR /&gt;__&lt;BR /&gt;49&lt;BR /&gt;__&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space&lt;BR /&gt;between a quoted string and the succeeding identifier is recommended.&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, ), *, **, +, ',', -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, ?, AND, BETWEEN,&lt;BR /&gt;CONTAINS, EQ, GE, GT, IN, IS, LE, LIKE, LT, NE, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;22: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, CUROBS, END, INDSNAME, KEY, KEYRESET, KEYS,&lt;BR /&gt;NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.&lt;BR /&gt;200: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;2 The SAS System 10:30 Tuesday, May 15, 2018&lt;/P&gt;&lt;P&gt;22: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 22-322: Expecting a name.&lt;BR /&gt;200: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;22: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 22-322: Expecting a name.&lt;BR /&gt;200: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;22: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 22-322: Expecting a name.&lt;BR /&gt;200: LINE and COLUMN cannot be determined.&lt;BR /&gt;NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;ERROR: Syntax error while parsing WHERE clause.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 03:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462248#M117651</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2018-05-15T03:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: cant we assign macro variables in positional/keyword parameters in macros?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462253#M117654</link>
      <description>&lt;P&gt;Several errors here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro x(dat,time,var1);
data &amp;amp;dat;
set summary_ANZSIC (where=(mdate = input(compress("&amp;amp;time"),date9.)));
/* use the date9. format to get a SAS date value, the log reveals that curr_date comes in that format */
/* I'd rather do this anyway: */
set summary_ANZSIC (where=(mdate = "&amp;amp;time"d));
rename total_Tce = &amp;amp;var1._TCE;
rename weighted_PD = &amp;amp;var1._weightedPD;
rename wavgPD = &amp;amp;var1._wavgPD;
/* in the previous 3 lines, terminate the macrovar name with a dot */
run;
%mend;
%x(a1,&amp;amp;curr_date,curr);
/* don't use quotes around the date, as you already use quotes in the data step inside the macro */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 May 2018 04:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462253#M117654</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-15T04:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: cant we assign macro variables in positional/keyword parameters in macros?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462259#M117659</link>
      <description>&lt;P&gt;%macro x(test,time,var1);&lt;BR /&gt;data &amp;amp;test.;&lt;BR /&gt;set summary_ANZSIC;&lt;BR /&gt;where mdate= input(compress("&amp;amp;time."),10.);&lt;BR /&gt;rename total_Tce = &amp;amp;var1._TCE;&lt;BR /&gt;rename weighted_PD = &amp;amp;var1._weightedPD;&lt;BR /&gt;rename wavgPD = &amp;amp;var1._wavgPD;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;BR /&gt;%x(a1,&amp;amp;curr_date,curr);&lt;BR /&gt;%x(a2,&amp;amp;last_yr_date,prev);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;updated the code as above..&lt;/P&gt;&lt;P&gt;Working now..thanks everyone..&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 05:11:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462259#M117659</guid>
      <dc:creator>BaalaRaaji</dc:creator>
      <dc:date>2018-05-15T05:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: cant we assign macro variables in positional/keyword parameters in macros?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462357#M117709</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44464"&gt;@BaalaRaaji&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;%macro x(test,time,var1);&lt;BR /&gt;data &amp;amp;test.;&lt;BR /&gt;set summary_ANZSIC;&lt;BR /&gt;where mdate= input(compress("&amp;amp;time."),10.);&lt;BR /&gt;rename total_Tce = &amp;amp;var1._TCE;&lt;BR /&gt;rename weighted_PD = &lt;FONT color="#0000ff"&gt;&amp;amp;var1._weightedPD&lt;/FONT&gt;;&lt;BR /&gt;rename wavgPD = &amp;amp;var1._wavgPD;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;BR /&gt;%x(a1,&amp;amp;curr_date,curr);&lt;BR /&gt;%x(a2,&amp;amp;last_yr_date,prev);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;updated the code as above..&lt;/P&gt;
&lt;P&gt;Working now..thanks everyone..&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Be aware that creating new variable names with fixed suffixes means that you must be careful not to pass a variable name such that the "new" name is not truncated. Adding "_weightedPD", 11 characters,&amp;nbsp;to a variable name means that if the length of &amp;amp;var1 ever exceeds 21 characters you will have a new variable name greater than the allowed 32 characters and the result will be truncated. So later reference to &amp;amp;var1._unweightedPD may generate errors as the variable won't have that name.&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 14:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/cant-we-assign-macro-variables-in-positional-keyword-parameters/m-p/462357#M117709</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-15T14:00:38Z</dc:date>
    </item>
  </channel>
</rss>

