<?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: Macro errors in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643834#M192194</link>
    <description>&lt;P&gt;I see that we need to work on the choice of words.&lt;/P&gt;
&lt;P&gt;A &lt;EM&gt;dataset&lt;/EM&gt;&amp;nbsp;(or "table") consists of &lt;EM&gt;observations&lt;/EM&gt; (called "rows" in other environments)&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Observations&lt;/EM&gt; contain &lt;EM&gt;variables&lt;/EM&gt; (often called "columns" in other environments)&lt;/P&gt;
&lt;P&gt;A multiple of &lt;EM&gt;observations&lt;/EM&gt; can make up &lt;EM&gt;groups&lt;/EM&gt;; you can have several layers of groupings within a dataset&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Within these context, where would you put "step"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To solve your question, it would be &lt;U&gt;very&lt;/U&gt; helpful to have data and the expected result from it.&lt;/P&gt;
&lt;P&gt;To post example data in a usable way, create a data step with datalines and post it as previously mentioned.&lt;/P&gt;</description>
    <pubDate>Wed, 29 Apr 2020 08:43:53 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-04-29T08:43:53Z</dc:date>
    <item>
      <title>Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643524#M192069</link>
      <description>&lt;P&gt;I am trying to execute this code/macro, but there is some error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro sqlloop(start,end,step,pocetak,kraj);&lt;BR /&gt;PROC SQL;&lt;BR /&gt;%DO i=&amp;amp;start. %TO &amp;amp;end. %BY &amp;amp;step.;&lt;BR /&gt;%DO j=&amp;amp;pocetak. %TO &amp;amp;kraj.;&lt;BR /&gt;%makro(i,j);&lt;BR /&gt;%END;&lt;BR /&gt;%END;&lt;BR /&gt;QUIT;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%sqlloop(start=0, end=0.2507245866,step = 0.001,pocetak=1, kraj=242)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;BR /&gt;&amp;amp;end.&lt;BR /&gt;ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;BR /&gt;&amp;amp;step.&lt;BR /&gt;ERROR: The %BY value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: The macro SQLLOOP will stop executing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible fro macro to work with decimal numbers? Or something else is problem?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643524#M192069</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T11:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643526#M192071</link>
      <description>&lt;P&gt;...And what is proposal hot to join all tables made in macro? Since,&amp;nbsp; those tables contain just one row, I want them one below another in one table.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:17:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643526#M192071</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T11:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643527#M192072</link>
      <description>&lt;P&gt;First, set these options in the first line of your program and run it again.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen mlogic;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Show us the entire log for this step, with nothing chopped out. We need to see the code, NOTEs, WARNINGs and ERRORs. The next part is &lt;STRONG&gt;absolutely crucial, &lt;FONT color="#FF0000"&gt;do not skip this next part&lt;/FONT&gt;. &lt;/STRONG&gt;Click on the &amp;lt;/&amp;gt; icon and paste the log into the window that appear. This will help us interpret the log by maintaining the formatting and spacing, please help us out and help yourself as well by doing this. &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Do not skip this part&lt;/FONT&gt;.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643527#M192072</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-28T11:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643528#M192073</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/324644"&gt;@JovanaUniCredit&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;...And what is proposal hot to join all tables made in macro? Since,&amp;nbsp; those tables contain just one row, I want them one below another in one table.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please explain what you are trying to achieve. I don't think that the loops are necessary at all - at least not as macro-code. &lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:18:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643528#M192073</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-04-28T11:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643529#M192074</link>
      <description>&lt;P&gt;Should I run whole program or just that line that you wrote me?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643529#M192074</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T11:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643531#M192076</link>
      <description>&lt;P&gt;The export from my macro should be more than 200 tables with just one row. I want to join them, with all rows in one table one below another.&lt;/P&gt;&lt;P&gt;I did this like this:&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE bete as&lt;BR /&gt;SELECT * FROM CTAge_obs1&lt;BR /&gt;UNION SELECT * FROM CTAge_obs2&lt;BR /&gt;UNION SELECT * FROM CTAge_obs3&lt;BR /&gt;UNION SELECT * FROM CTAge_obs4&lt;BR /&gt;UNION SELECT * FROM CTAge_obs5&lt;BR /&gt;UNION SELECT * FROM CTAge_obs6&lt;BR /&gt;UNION SELECT * FROM CTAge_obs7&lt;BR /&gt;UNION SELECT * FROM CTAge_obs8&lt;BR /&gt;UNION SELECT * FROM CTAge_obs9&lt;BR /&gt;UNION SELECT * FROM CTAge_obs10&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;until the last table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can it be done on more sophisticated way? Not to write it more than 200 times?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:22:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643531#M192076</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T11:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643533#M192077</link>
      <description>&lt;P&gt;Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;From&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=mcrolref&amp;amp;docsetTarget=p0ri72c3ud2fdtn1qzs2q9vvdiwk.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;%DO, Iterative Macro Statements:&lt;/A&gt;&lt;/P&gt;
&lt;DIV class="xisDoc-syntax"&gt;
&lt;DIV class="xisDoc-syntaxDescription"&gt;
&lt;DIV class="xisDoc-requiredArgGroup"&gt;
&lt;H3 id="p0b5ut5elvleijn1mjyw06xne30h" class="xisDoc-title"&gt;Required Arguments&lt;/H3&gt;
&lt;DIV id="p0jnr91swetg1mn14fgnqyevnk5a" class="xisDoc-argDescriptionPair"&gt;
&lt;H4 class="xisDoc-argument"&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;macro-variable&lt;/EM&gt;&lt;/H4&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;P class="xisDoc-paraSimpleFirst"&gt;names a macro variable or a text expression that generates a macro variable name. Its value functions as an index that determines the number of times the %DO loop iterates. If the macro variable specified as the index does not exist, the macro processor creates it in the local symbol table.&lt;/P&gt;
&lt;P class="xisDoc-paraSimple"&gt;You can change the value of the index variable during processing. For example, using conditional processing to set the value of the index variable beyond the &lt;EM class="xisDoc-userSuppliedValue"&gt;stop&lt;/EM&gt; value when a certain condition is met ends processing of the loop.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="p1h69tgzuz894vn1s61vq0ucjbo5" class="xisDoc-argDescriptionPair"&gt;
&lt;H4 class="xisDoc-argument"&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;start&lt;/EM&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;stop&lt;/EM&gt;&lt;/H4&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;P class="xisDoc-paraSimpleFirst"&gt;specify &lt;STRONG&gt;integers or macro expressions that generate integers&lt;/STRONG&gt; to control the number of times the portion of the macro between the iterative %DO and %END statements is processed.&lt;/P&gt;
&lt;P class="xisDoc-paraSimple"&gt;The first time the %DO group iterates, &lt;EM class="xisDoc-userSuppliedValue"&gt;macro-variable&lt;/EM&gt; is equal to &lt;EM class="xisDoc-userSuppliedValue"&gt;start&lt;/EM&gt;. As processing continues, the value of &lt;EM class="xisDoc-userSuppliedValue"&gt;macro-variable&lt;/EM&gt; changes by the value of &lt;EM class="xisDoc-userSuppliedValue"&gt;increment&lt;/EM&gt; until the value of &lt;EM class="xisDoc-userSuppliedValue"&gt;macro-variable&lt;/EM&gt; is outside the range of integers included by &lt;EM class="xisDoc-userSuppliedValue"&gt;start&lt;/EM&gt; and &lt;EM class="xisDoc-userSuppliedValue"&gt;stop&lt;/EM&gt;.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="n0mnkfgxxsi4l4n1qml6p3ezc3qi" class="xisDoc-argDescriptionPair"&gt;
&lt;H4 class="xisDoc-argument"&gt;&lt;EM class="xisDoc-userSuppliedValue"&gt;increment&lt;/EM&gt;&lt;/H4&gt;
&lt;DIV class="xisDoc-argumentDescription"&gt;
&lt;P class="xisDoc-paraSimpleFirst"&gt;specifies an &lt;STRONG&gt;integer&lt;/STRONG&gt; (other than 0) or a macro expression that generates an integer to be added to the value of the index variable in each iteration of the loop. By default, &lt;EM class="xisDoc-userSuppliedValue"&gt;increment&lt;/EM&gt; is 1. &lt;EM class="xisDoc-userSuppliedValue"&gt;Increment&lt;/EM&gt; is evaluated before the first iteration of the loop. Therefore, you cannot change it as the loop iterates.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="n14j9s74jyqxhdn13ktxn21m0qa0" class="xisDoc-exampleBlock"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xisDoc-exampleBlock"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xisDoc-exampleBlock"&gt;(Emphasis by me)&lt;/DIV&gt;
&lt;DIV class="xisDoc-exampleBlock"&gt;The macro preprocessor, as a pure code generator, has no use for non-integers, as you don't repeat a statement 0.1 or 2.5 times.&lt;/DIV&gt;
&lt;DIV class="xisDoc-exampleBlock"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="xisDoc-exampleBlock"&gt;Which code do you want to create with your macro construction?&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643533#M192077</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-28T11:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643534#M192078</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/324644"&gt;@JovanaUniCredit&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Should I run whole program or just that line that you wrote me?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You run the entire program again, with those options in the first line of the code.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:24:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643534#M192078</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-28T11:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643535#M192079</link>
      <description>&lt;P&gt;That is MUCH easier accomplished with a dead-simple data step and NO macro code AT ALL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bete;
set ctage_obs:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bete;
set ctage_obs1-ctage_obs200;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/324644"&gt;@JovanaUniCredit&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The export from my macro should be more than 200 tables with just one row. I want to join them, with all rows in one table one below another.&lt;/P&gt;
&lt;P&gt;I did this like this:&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE bete as&lt;BR /&gt;SELECT * FROM CTAge_obs1&lt;BR /&gt;UNION SELECT * FROM CTAge_obs2&lt;BR /&gt;UNION SELECT * FROM CTAge_obs3&lt;BR /&gt;UNION SELECT * FROM CTAge_obs4&lt;BR /&gt;UNION SELECT * FROM CTAge_obs5&lt;BR /&gt;UNION SELECT * FROM CTAge_obs6&lt;BR /&gt;UNION SELECT * FROM CTAge_obs7&lt;BR /&gt;UNION SELECT * FROM CTAge_obs8&lt;BR /&gt;UNION SELECT * FROM CTAge_obs9&lt;BR /&gt;UNION SELECT * FROM CTAge_obs10&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;until the last table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can it be done on more sophisticated way? Not to write it more than 200 times?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:29:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643535#M192079</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-28T11:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643539#M192082</link>
      <description>&lt;P&gt;This is the output of the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 The SAS System Tuesday, April 28, 2020 12:45:00 PM&lt;/P&gt;&lt;P&gt;1 ;*';*";*/;quit;run;&lt;BR /&gt;2 OPTIONS PAGENO=MIN;&lt;BR /&gt;3 %LET _CLIENTTASKLABEL='Program';&lt;BR /&gt;4 %LET _CLIENTPROCESSFLOWNAME='Process Flow';&lt;BR /&gt;5 %LET _CLIENTPROJECTPATH='\\srvnas\common\CRO\Strategic Risk\Credit risk Governance and Models\Credit Risk Modeling\IFRS&lt;BR /&gt;5 ! 9\03 IFRS 9 Modeling\02 IFRS 9 TL modeling\QE &amp;amp; TL 2020\Transfer logic\IFRS 9 2020 TL v8.egp';&lt;BR /&gt;6 %LET _CLIENTPROJECTPATHHOST='UCB29756';&lt;BR /&gt;7 %LET _CLIENTPROJECTNAME='IFRS 9 2020 TL v8.egp';&lt;BR /&gt;8 %LET _SASPROGRAMFILE='';&lt;BR /&gt;9 %LET _SASPROGRAMFILEHOST='';&lt;BR /&gt;10&lt;BR /&gt;11 ODS _ALL_ CLOSE;&lt;BR /&gt;12 OPTIONS DEV=PNG;&lt;BR /&gt;13 GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;14 FILENAME EGSR TEMP;&lt;BR /&gt;15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR&lt;BR /&gt;16 STYLE=HtmlBlue&lt;BR /&gt;17 STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome/x86/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")&lt;BR /&gt;18 NOGTITLE&lt;BR /&gt;19 NOGFOOTNOTE&lt;BR /&gt;20 GPATH=&amp;amp;sasworklocation&lt;BR /&gt;SYMBOLGEN: Macro variable SASWORKLOCATION resolves to "F:\WORK\_TD4820_SRVSAS06_\Prc2/"&lt;BR /&gt;21 ENCODING=UTF8&lt;BR /&gt;22 options(rolap="on")&lt;BR /&gt;23 ;&lt;BR /&gt;NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR&lt;BR /&gt;24&lt;BR /&gt;25 GOPTIONS ACCESSIBLE;&lt;BR /&gt;26 options mprint symbolgen mlogic;&lt;BR /&gt;27 options compress=binary;&lt;BR /&gt;28&lt;BR /&gt;29&lt;BR /&gt;30&lt;BR /&gt;31 DATA QntRegTest;&lt;BR /&gt;32 SET QntRegCorp /*QntRegCorpNonRev*/ /*QntRegCorpREV*/;&lt;BR /&gt;33&lt;BR /&gt;34 /*ISTA JE PODELA KOD SVA 3 segmenta*/&lt;BR /&gt;35 IF RatingClassFirstAv in (1,2,3,4,5) THEN I1 = 1;&lt;BR /&gt;36 ELSE I1 = 0;&lt;BR /&gt;37 IF RatingClassFirstAv in (6,7,8) THEN I2 = 1;&lt;BR /&gt;38 ELSE I2 = 0;&lt;BR /&gt;39&lt;BR /&gt;40 LnAge1 = LnAge*I1;&lt;BR /&gt;41 LnAge2 = LnAge*I2;&lt;BR /&gt;42&lt;BR /&gt;43 RUN;&lt;/P&gt;&lt;P&gt;NOTE: There were 26168 observations read from the data set WORK.QNTREGCORP.&lt;BR /&gt;NOTE: The data set WORK.QNTREGTEST has 26168 observations and 79 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.QNTREGTEST decreased size by 83.41 percent.&lt;BR /&gt;Compressed is 106 pages; un-compressed would require 639 pages.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.32 seconds&lt;BR /&gt;cpu time 0.32 seconds&lt;/P&gt;&lt;P&gt;44&lt;BR /&gt;45 PROC QUANTREG DATA=QntRegTest OUTest=QntRegEst algorithm=interior (tolerance=1e-5) ci=resampling;&lt;BR /&gt;2 The SAS System Tuesday, April 28, 2020 12:45:00 PM&lt;/P&gt;&lt;P&gt;46 MODELLnAge12WORM: MODEL AP1 = LnPD0 LnAge1 LnAge2 / quantile=0.9 /*plots=all*/;&lt;BR /&gt;47 /*testAll: test LnPD0 LnAge1 LnAge2/ wald lr*/;&lt;BR /&gt;48 OUTPUT OUT=QntRegLnAge12 p=predicted;&lt;BR /&gt;49 title 'Quantile regression';&lt;BR /&gt;50 RUN;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.QNTREGEST has 1 observations and 10 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.QNTREGEST increased size by 100.00 percent.&lt;BR /&gt;Compressed is 2 pages; un-compressed would require 1 pages.&lt;BR /&gt;NOTE: The data set WORK.QNTREGLNAGE12 has 26168 observations and 81 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.QNTREGLNAGE12 decreased size by 82.79 percent.&lt;BR /&gt;Compressed is 110 pages; un-compressed would require 639 pages.&lt;BR /&gt;NOTE: PROCEDURE QUANTREG used (Total process time):&lt;BR /&gt;real time 1.12 seconds&lt;BR /&gt;cpu time 1.15 seconds&lt;/P&gt;&lt;P&gt;51&lt;BR /&gt;52 DATA check;&lt;BR /&gt;53 SET QntRegLnAge12;&lt;BR /&gt;54 IF AP1 &amp;gt; predicted then Stage = 2; else Stage = 1;&lt;BR /&gt;55 dummy = 1;&lt;BR /&gt;56 RUN;&lt;/P&gt;&lt;P&gt;NOTE: There were 26168 observations read from the data set WORK.QNTREGLNAGE12.&lt;BR /&gt;NOTE: The data set WORK.CHECK has 26168 observations and 83 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.CHECK decreased size by 83.05 percent.&lt;BR /&gt;Compressed is 111 pages; un-compressed would require 655 pages.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.23 seconds&lt;BR /&gt;cpu time 0.23 seconds&lt;/P&gt;&lt;P&gt;57&lt;BR /&gt;58 DATA QRParameters;&lt;BR /&gt;59 SET check;&lt;BR /&gt;60&lt;BR /&gt;61 Intercept = -0.6436; /*PROMENA*/&lt;BR /&gt;62 Coeff_LnPD0 = -0.2536; /*PROMENA*/&lt;BR /&gt;63 Coeff_LnAge1 = 0.6548; /*PROMENA*/&lt;BR /&gt;64 Coeff_LnAge2 = 0.2851; /*PROMENA*/&lt;BR /&gt;65 ALPHA =&lt;BR /&gt;65 ! SQRT((exp(Intercept+Coeff_LnPD0*log(0.005985769))*0.005985769)*(exp(Intercept+Coeff_LnPD0*log(0.023412558))*0.023412558))&lt;BR /&gt;65 ! ;&lt;BR /&gt;66 RUN;&lt;/P&gt;&lt;P&gt;NOTE: There were 26168 observations read from the data set WORK.CHECK.&lt;BR /&gt;NOTE: The data set WORK.QRPARAMETERS has 26168 observations and 88 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.QRPARAMETERS decreased size by 81.53 percent.&lt;BR /&gt;Compressed is 121 pages; un-compressed would require 655 pages.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.29 seconds&lt;BR /&gt;cpu time 0.29 seconds&lt;/P&gt;&lt;P&gt;67&lt;BR /&gt;68 DATA beta_min_max;&lt;BR /&gt;69 SET QRParameters;&lt;BR /&gt;3 The SAS System Tuesday, April 28, 2020 12:45:00 PM&lt;/P&gt;&lt;P&gt;70&lt;BR /&gt;71 IF (Coeff_LnAge1 &amp;gt; 0 AND Coeff_LnAge2 &amp;gt; 0) THEN DO;&lt;BR /&gt;72 MIN = 0;&lt;BR /&gt;73 MAX = (1- ALPHA)/LOG(50);&lt;BR /&gt;74 END;&lt;BR /&gt;75 ELSE IF (Coeff_LnAge1 &amp;lt; 0 AND Coeff_LnAge2 &amp;lt; 0) THEN MAX = 0 AND MIN = -1*(ALPHA)/LOG(50);&lt;BR /&gt;76 RUN;&lt;/P&gt;&lt;P&gt;NOTE: There were 26168 observations read from the data set WORK.QRPARAMETERS.&lt;BR /&gt;NOTE: The data set WORK.BETA_MIN_MAX has 26168 observations and 90 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.BETA_MIN_MAX decreased size by 81.38 percent.&lt;BR /&gt;Compressed is 119 pages; un-compressed would require 639 pages.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.29 seconds&lt;BR /&gt;cpu time 0.29 seconds&lt;/P&gt;&lt;P&gt;77&lt;BR /&gt;78 DATA realized_thresholds/*realized_thresholds_RCG1 realized_thresholds_RCG2*/;&lt;BR /&gt;79 SET beta_min_max (KEEP= LnPD0 PDPuncFirstAv RatingClassFirstAV RatingFirstAV RatingCurr RefDate Age ClientID ClientName&lt;BR /&gt;79 ! TransID SegmentFinal I1 I2 predicted PDPuncFirstAv PDPuncCurr Intercept Coeff_LnPD0 Coeff_LnAge1 Coeff_LnAge2 ALPHA MIN&lt;BR /&gt;79 ! MAX LnAge1 LnAge2);&lt;BR /&gt;80&lt;BR /&gt;81 PDThreshold = EXP(predicted)*PDPuncFirstAv; /* Predicted PD at reporting date (i.e. PD threshold)*/&lt;BR /&gt;82 IF PDThreshold &amp;gt;= 0.99 THEN PDThreshold = 0.99;&lt;BR /&gt;83 /*PDPuncCurr- OBSERVED PD at reporting date*/&lt;BR /&gt;84 IF (PDPuncCurr &amp;gt; PDThreshold) THEN StgChange = 1; /* boolean vector which indicates stage 2 obs. - 1's are in stage 2,&lt;BR /&gt;84 ! 0's in stage 1 */&lt;BR /&gt;85 ELSE StgChange = 0;&lt;BR /&gt;86&lt;BR /&gt;87 *IF I1 = 1 THEN OUTPUT realized_thresholds_RCG1;&lt;BR /&gt;88 *ELSE OUTPUT realized_thresholds_RCG2;&lt;BR /&gt;89 RUN;&lt;/P&gt;&lt;P&gt;NOTE: There were 26168 observations read from the data set WORK.BETA_MIN_MAX.&lt;BR /&gt;NOTE: The data set WORK.REALIZED_THRESHOLDS has 26168 observations and 26 variables.&lt;BR /&gt;NOTE: Compressing data set WORK.REALIZED_THRESHOLDS decreased size by 89.51 percent.&lt;BR /&gt;Compressed is 67 pages; un-compressed would require 639 pages.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.18 seconds&lt;BR /&gt;cpu time 0.18 seconds&lt;/P&gt;&lt;P&gt;90&lt;BR /&gt;91&lt;BR /&gt;92 PROC SQL;&lt;BR /&gt;93 CREATE TABLE obs_stg_change AS&lt;BR /&gt;94 SELECT t1.*, sum(t1.StgChange) as sum_StgChange,&lt;BR /&gt;95 count(t1.TransID) as no_obs,&lt;BR /&gt;96 (SUM(t1.StgChange))/count(t1.TransID) as QUANTILE,&lt;BR /&gt;97 (1-(SUM(t1.StgChange))/count(t1.TransID)) AS quantile_or&lt;BR /&gt;98&lt;BR /&gt;99 FROM realized_thresholds /*realized_thresholds_RCG1 realized_thresholds_RCG2*/ t1;&lt;BR /&gt;NOTE: The query requires remerging summary statistics back with the original data.&lt;BR /&gt;NOTE: Compressing data set WORK.OBS_STG_CHANGE decreased size by 88.55 percent.&lt;BR /&gt;Compressed is 75 pages; un-compressed would require 655 pages.&lt;BR /&gt;NOTE: Table WORK.OBS_STG_CHANGE created, with 26168 rows and 30 columns.&lt;/P&gt;&lt;P&gt;4 The SAS System Tuesday, April 28, 2020 12:45:00 PM&lt;/P&gt;&lt;P&gt;100&lt;BR /&gt;101 QUIT;&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.21 seconds&lt;BR /&gt;cpu time 0.21 seconds&lt;/P&gt;&lt;P&gt;102&lt;BR /&gt;103&lt;BR /&gt;104 %macro makro(korak,broj);&lt;BR /&gt;105 DATA CTAge;&lt;BR /&gt;106 SET obs_stg_change;&lt;BR /&gt;107 step=((1-alpha)/log(50))/(50-1);&lt;BR /&gt;108 y= alpha+ &amp;amp;korak*log(Age);&lt;BR /&gt;109 IF(I1=1) THEN min_Threshold = min(y,PDThreshold);&lt;BR /&gt;110 IF(I2=1) THEN max_Threshold = max(y,PDThreshold);&lt;BR /&gt;111 min_max_Threshold=COALESCE(min_Threshold, max_Threshold);&lt;BR /&gt;112 IF PDPuncCurr &amp;gt; min_max_Threshold THEN StgChange_CT = 1; ELSE StgChange_CT = 0;&lt;BR /&gt;113 RUN;&lt;BR /&gt;114&lt;BR /&gt;115 /*0.5757232999 SUM SQUARE*/&lt;BR /&gt;116&lt;BR /&gt;117 PROC SQL;&lt;BR /&gt;118 CREATE TABLE CTAge_obs&amp;amp;broj AS&lt;BR /&gt;119 SELECT &amp;amp;korak AS step, min(t1.sum_StgChange) as sum_StgChange,&lt;BR /&gt;120 (SUM(t1.StgChange_CT)) AS SUM_StgChange_CT, /*a1*//* count # of obs which change stage */&lt;BR /&gt;121 /* (SUM(t1.StgChange_CT) - t1.sum_StgChange) AS PROVERA,*/&lt;BR /&gt;122 /* (SUM(abs(t1.StgChange_CT-t1.StgChange))) AS SUM_StgChange_DIFF,*/ /*Calculate distance between old CT and&lt;BR /&gt;122 ! new one */&lt;BR /&gt;123 (SUM((t1.min_max_Threshold-t1.PDThreshold)**2)) AS SSQ2, /*sum of square*/&lt;BR /&gt;124 SQRT(SUM((t1.min_max_Threshold-t1.PDThreshold)**2)) AS dist_prov, /* square root of the distance */&lt;BR /&gt;125 ABS(SUM(t1.StgChange_CT) - min(t1.sum_StgChange)) AS err_stage2, /* Sum of obs which change stage */&lt;BR /&gt;126 ABS(SUM(t1.StgChange_CT)-sum(t1.StgChange))/MIN(t1.no_obs) AS ee&lt;BR /&gt;127 FROM WORK.CTAge t1;&lt;BR /&gt;128 QUIT;&lt;BR /&gt;129 %mend;&lt;BR /&gt;130&lt;BR /&gt;131 %macro sqlloop(start,end,step,pocetak,kraj);&lt;BR /&gt;132 PROC SQL;&lt;BR /&gt;133 %DO i=&amp;amp;start. %TO &amp;amp;end. %BY &amp;amp;step.;&lt;BR /&gt;134 %DO j=&amp;amp;pocetak. %TO &amp;amp;kraj.;&lt;BR /&gt;135 %makro(i,j);&lt;BR /&gt;136 %END;&lt;BR /&gt;137 %END;&lt;BR /&gt;138 QUIT;&lt;BR /&gt;139 %mend;&lt;BR /&gt;140&lt;BR /&gt;141 GOPTIONS NOACCESSIBLE;&lt;BR /&gt;142 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;143 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;144 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;145 %LET _CLIENTPROJECTPATHHOST=;&lt;BR /&gt;146 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;147 %LET _SASPROGRAMFILE=;&lt;BR /&gt;148 %LET _SASPROGRAMFILEHOST=;&lt;BR /&gt;149&lt;BR /&gt;150 ;*';*";*/;quit;run;&lt;BR /&gt;151 ODS _ALL_ CLOSE;&lt;BR /&gt;5 The SAS System Tuesday, April 28, 2020 12:45:00 PM&lt;/P&gt;&lt;P&gt;152&lt;BR /&gt;153&lt;BR /&gt;154 QUIT; RUN;&lt;BR /&gt;155&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is strange that now there is no error, but no tabels in output of the macro exists.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643539#M192082</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T11:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643541#M192084</link>
      <description>&lt;P&gt;Does it mean that my macro cannot work with decimal numbers?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SInce arguments for my macro are decimal numbers.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643541#M192084</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T11:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643543#M192085</link>
      <description>&lt;P&gt;I asked you to not skip the step of pasting the log into the window that appears when you click on the &amp;lt;/&amp;gt; icon, and you skipped this step. Please provide the log by following the instructions given. This help us interpret the log properly, and thus you get faster/better answers.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643543#M192085</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-28T11:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643546#M192088</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/324644"&gt;@JovanaUniCredit&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Does it mean that my macro cannot work with decimal numbers?.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's obvious from the doc, isn't it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I repeat my question: which code do you want to create with your macro construction? If you really need decimals as parameters for another macro, you can create them in a data step, and use CALL EXECUTE() to execute the code that needs those decimals.&lt;/P&gt;
&lt;P&gt;But before we talk about methods, we need to know the final goal.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:37:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643546#M192088</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-28T11:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643547#M192089</link>
      <description>Thank you, this helps a lot!&lt;BR /&gt;&lt;BR /&gt;A what about my first macro?&lt;BR /&gt;&lt;BR /&gt;I wrote this :&lt;BR /&gt;%macro makro(korak,broj);&lt;BR /&gt;DATA CTAge;&lt;BR /&gt;SET obs_stg_change;&lt;BR /&gt;step=((1-alpha)/log(50))/(50-1);&lt;BR /&gt;y= alpha+ &amp;amp;korak*log(Age);&lt;BR /&gt;IF(I1=1) THEN min_Threshold = min(y,PDThreshold);&lt;BR /&gt;IF(I2=1) THEN max_Threshold = max(y,PDThreshold);&lt;BR /&gt;min_max_Threshold=COALESCE(min_Threshold, max_Threshold);&lt;BR /&gt;IF PDPuncCurr &amp;gt; min_max_Threshold THEN StgChange_CT = 1; ELSE StgChange_CT = 0;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;/*0.5757232999 SUM SQUARE*/&lt;BR /&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE CTAge_obs&amp;amp;broj AS&lt;BR /&gt;SELECT &amp;amp;korak AS step, min(t1.sum_StgChange) as sum_StgChange,&lt;BR /&gt;(SUM(t1.StgChange_CT)) AS SUM_StgChange_CT, /*a1*//* count # of obs which change stage */&lt;BR /&gt;/* (SUM(t1.StgChange_CT) - t1.sum_StgChange) AS PROVERA,*/&lt;BR /&gt;/* (SUM(abs(t1.StgChange_CT-t1.StgChange))) AS SUM_StgChange_DIFF,*/ /*Calculate distance between old CT and new one */&lt;BR /&gt;(SUM((t1.min_max_Threshold-t1.PDThreshold)**2)) AS SSQ2, /*sum of square*/&lt;BR /&gt;SQRT(SUM((t1.min_max_Threshold-t1.PDThreshold)**2)) AS dist_prov, /* square root of the distance */&lt;BR /&gt;ABS(SUM(t1.StgChange_CT) - min(t1.sum_StgChange)) AS err_stage2, /* Sum of obs which change stage */&lt;BR /&gt;ABS(SUM(t1.StgChange_CT)-sum(t1.StgChange))/MIN(t1.no_obs) AS ee&lt;BR /&gt;FROM WORK.CTAge t1;&lt;BR /&gt;QUIT;&lt;BR /&gt;%mend;&lt;BR /&gt;%makro(0,1);&lt;BR /&gt;%makro(0.001,2);&lt;BR /&gt;%makro(0.0011,3);&lt;BR /&gt;%makro(0.0012,4);&lt;BR /&gt;%makro(0.0013,5);&lt;BR /&gt;%makro(0.0014,6);&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;just like the statement from previous my comment, more that 200 times- that is the number of my steps, that I have to calculate, and I wanted to shorten it with:&lt;BR /&gt;%macro sqlloop(start,end,step,pocetak,kraj);&lt;BR /&gt;PROC SQL;&lt;BR /&gt;%DO i=&amp;amp;start. %TO &amp;amp;end. %BY &amp;amp;step.;&lt;BR /&gt;%DO j=&amp;amp;pocetak. %TO &amp;amp;kraj.;&lt;BR /&gt;%makro(i,j);&lt;BR /&gt;%END;&lt;BR /&gt;%END;&lt;BR /&gt;QUIT;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;%sqlloop(start=0, end=0.2507245866,step = 0.001,pocetak=1, kraj=242)&lt;BR /&gt;&lt;BR /&gt;But it doesn't work. The error was:&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;BR /&gt;&amp;amp;end.&lt;BR /&gt;ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;BR /&gt;&amp;amp;step.&lt;BR /&gt;ERROR: The %BY value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: The macro SQLLOOP will stop executing.&lt;BR /&gt;&lt;BR /&gt;So, I concluded that there is problem with decimal numbers in macro.&lt;BR /&gt;&lt;BR /&gt;Am I right?</description>
      <pubDate>Tue, 28 Apr 2020 11:37:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643547#M192089</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T11:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643555#M192094</link>
      <description>&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;PLEASE&lt;/STRONG&gt;&lt;/FONT&gt; (and I mean that!) use the proper subwindows for posting code and logs, as already demanded by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;. It is NOT rocket science, and it won't make your head explode. Promised.&lt;/P&gt;
&lt;P&gt;Use the &amp;lt;/&amp;gt; button for logs and other structured text:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.png"&gt;&lt;img src="https://communities.sas.com/skins/images/70F8802BAA6255D55FBEC62A8226FB10/responsive_peak/images/image_not_found.png" alt="Bildschirmfoto 2020-04-07 um 08.32.59.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;and use the "little running man" right next to it for code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your macro can easily be translated to data step code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
do i = 0 to 0.2507245866 by .001;
  do  j = 1 to 242;
    call execute(cats('%nrstr(%makro(',i,',',j,'))'));
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that your do loop will not result in the values you posted, you'll get&lt;/P&gt;
&lt;PRE&gt;0
.001
.002
.003&lt;/PRE&gt;
&lt;P&gt;instead&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 11:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643555#M192094</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-28T11:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643583#M192109</link>
      <description>&lt;PRE&gt;1                                                          The SAS System                        Tuesday, April 28, 2020 12:45:00 PM

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Program';
4          %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5          %LET _CLIENTPROJECTPATH='\\srvnas\common\CRO\Strategic Risk\Credit risk Governance and Models\Credit Risk Modeling\IFRS
5        ! 9\03 IFRS 9 Modeling\02 IFRS 9 TL modeling\QE &amp;amp; TL 2020\Transfer logic\IFRS 9 2020 TL v8.egp';
6          %LET _CLIENTPROJECTPATHHOST='UCB29756';
7          %LET _CLIENTPROJECTNAME='IFRS 9 2020 TL v8.egp';
8          %LET _SASPROGRAMFILE='';
9          %LET _SASPROGRAMFILEHOST='';
10         
11         ODS _ALL_ CLOSE;
12         OPTIONS DEV=PNG;
13         GOPTIONS XPIXELS=0 YPIXELS=0;
14         FILENAME EGSR TEMP;
15         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16             STYLE=HtmlBlue
17             STYLESHEET=(URL="file:///C:/Program%20Files%20(x86)/SASHome/x86/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
18             NOGTITLE
19             NOGFOOTNOTE
20             GPATH=&amp;amp;sasworklocation
SYMBOLGEN:  Macro variable SASWORKLOCATION resolves to "F:\WORK\_TD4820_SRVSAS06_\Prc2/"
21             ENCODING=UTF8
22             options(rolap="on")
23         ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24         
25         GOPTIONS ACCESSIBLE;
26         options mprint symbolgen mlogic;
27         options compress=binary;
28         
29         
30         
31         DATA QntRegTest;
32         SET QntRegCorp /*QntRegCorpNonRev*/ /*QntRegCorpREV*/;
33         
34         /*ISTA JE PODELA KOD SVA 3 segmenta*/
35         IF RatingClassFirstAv in (1,2,3,4,5) THEN I1 = 1;
36         ELSE I1 = 0;
37         IF RatingClassFirstAv in (6,7,8) THEN I2 = 1;
38         ELSE I2 = 0;
39         
40         LnAge1 = LnAge*I1;
41         LnAge2 = LnAge*I2;
42         
43         RUN;

NOTE: There were 26168 observations read from the data set WORK.QNTREGCORP.
NOTE: The data set WORK.QNTREGTEST has 26168 observations and 79 variables.
NOTE: Compressing data set WORK.QNTREGTEST decreased size by 83.41 percent. 
      Compressed is 106 pages; un-compressed would require 639 pages.
NOTE: DATA statement used (Total process time):
      real time           0.25 seconds
      cpu time            0.25 seconds
      

44         
45         PROC QUANTREG DATA=QntRegTest OUTest=QntRegEst algorithm=interior (tolerance=1e-5) ci=resampling;
2                                                          The SAS System                        Tuesday, April 28, 2020 12:45:00 PM

46         	MODELLnAge12WORM: MODEL AP1 = LnPD0 LnAge1 LnAge2 / quantile=0.9 /*plots=all*/;
47         	/*testAll: test LnPD0 LnAge1 LnAge2/ wald lr*/;
48         	OUTPUT OUT=QntRegLnAge12 p=predicted;
49         	title 'Quantile regression';
50         RUN;

NOTE: The data set WORK.QNTREGEST has 1 observations and 10 variables.
NOTE: Compressing data set WORK.QNTREGEST increased size by 100.00 percent. 
      Compressed is 2 pages; un-compressed would require 1 pages.
NOTE: The data set WORK.QNTREGLNAGE12 has 26168 observations and 81 variables.
NOTE: Compressing data set WORK.QNTREGLNAGE12 decreased size by 82.79 percent. 
      Compressed is 110 pages; un-compressed would require 639 pages.
NOTE: PROCEDURE QUANTREG used (Total process time):
      real time           1.15 seconds
      cpu time            1.15 seconds
      

51         
52         DATA check;
53         SET QntRegLnAge12;
54         IF AP1 &amp;gt; predicted then Stage = 2; else Stage = 1;
55         dummy = 1;
56         RUN;

NOTE: There were 26168 observations read from the data set WORK.QNTREGLNAGE12.
NOTE: The data set WORK.CHECK has 26168 observations and 83 variables.
NOTE: Compressing data set WORK.CHECK decreased size by 83.05 percent. 
      Compressed is 111 pages; un-compressed would require 655 pages.
NOTE: DATA statement used (Total process time):
      real time           0.25 seconds
      cpu time            0.25 seconds
      

57         
58         DATA QRParameters;
59         SET check;
60         
61         Intercept = -0.6436; /*PROMENA*/
62         Coeff_LnPD0 = -0.2536; /*PROMENA*/
63         Coeff_LnAge1 = 0.6548; /*PROMENA*/
64         Coeff_LnAge2 = 0.2851; /*PROMENA*/
65         ALPHA =
65       ! SQRT((exp(Intercept+Coeff_LnPD0*log(0.005985769))*0.005985769)*(exp(Intercept+Coeff_LnPD0*log(0.023412558))*0.023412558))
65       ! ;
66         RUN;

NOTE: There were 26168 observations read from the data set WORK.CHECK.
NOTE: The data set WORK.QRPARAMETERS has 26168 observations and 88 variables.
NOTE: Compressing data set WORK.QRPARAMETERS decreased size by 81.53 percent. 
      Compressed is 121 pages; un-compressed would require 655 pages.
NOTE: DATA statement used (Total process time):
      real time           0.26 seconds
      cpu time            0.26 seconds
      

67         
68         DATA beta_min_max;
69         SET QRParameters;
3                                                          The SAS System                        Tuesday, April 28, 2020 12:45:00 PM

70         
71         IF (Coeff_LnAge1 &amp;gt; 0 AND Coeff_LnAge2 &amp;gt; 0) THEN DO;
72         MIN = 0;
73         MAX = (1- ALPHA)/LOG(50);
74         END;
75         ELSE IF (Coeff_LnAge1 &amp;lt; 0 AND Coeff_LnAge2 &amp;lt; 0) THEN MAX = 0 AND MIN =  -1*(ALPHA)/LOG(50);
76         RUN;

NOTE: There were 26168 observations read from the data set WORK.QRPARAMETERS.
NOTE: The data set WORK.BETA_MIN_MAX has 26168 observations and 90 variables.
NOTE: Compressing data set WORK.BETA_MIN_MAX decreased size by 81.38 percent. 
      Compressed is 119 pages; un-compressed would require 639 pages.
NOTE: DATA statement used (Total process time):
      real time           0.26 seconds
      cpu time            0.26 seconds
      

77         
78         DATA realized_thresholds/*realized_thresholds_RCG1 realized_thresholds_RCG2*/;
79         SET beta_min_max  (KEEP= LnPD0 PDPuncFirstAv RatingClassFirstAV RatingFirstAV RatingCurr RefDate Age ClientID ClientName
79       ! TransID SegmentFinal I1 I2 predicted PDPuncFirstAv PDPuncCurr Intercept Coeff_LnPD0 Coeff_LnAge1 Coeff_LnAge2 ALPHA MIN
79       ! MAX LnAge1 LnAge2);
80         
81         PDThreshold = EXP(predicted)*PDPuncFirstAv; /* Predicted PD at reporting date (i.e. PD threshold)*/
82         IF PDThreshold &amp;gt;= 0.99 THEN PDThreshold = 0.99;
83         /*PDPuncCurr- OBSERVED PD at reporting date*/
84         IF (PDPuncCurr &amp;gt; PDThreshold) THEN StgChange = 1; /* boolean vector which indicates stage 2 obs. - 1's are in stage 2,
84       ! 0's in stage 1 */
85         ELSE StgChange = 0;
86         
87         *IF I1 = 1 THEN OUTPUT realized_thresholds_RCG1;
88         *ELSE OUTPUT realized_thresholds_RCG2;
89         RUN;

NOTE: There were 26168 observations read from the data set WORK.BETA_MIN_MAX.
NOTE: The data set WORK.REALIZED_THRESHOLDS has 26168 observations and 26 variables.
NOTE: Compressing data set WORK.REALIZED_THRESHOLDS decreased size by 89.51 percent. 
      Compressed is 67 pages; un-compressed would require 639 pages.
NOTE: DATA statement used (Total process time):
      real time           0.18 seconds
      cpu time            0.17 seconds
      

90         
91         
92         PROC SQL;
93         CREATE TABLE obs_stg_change AS
94         SELECT t1.*, sum(t1.StgChange) as sum_StgChange,
95         	count(t1.TransID) as no_obs,
96         	(SUM(t1.StgChange))/count(t1.TransID) as QUANTILE,
97             (1-(SUM(t1.StgChange))/count(t1.TransID)) AS quantile_or
98         
99         FROM  realized_thresholds /*realized_thresholds_RCG1 realized_thresholds_RCG2*/ t1;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Compressing data set WORK.OBS_STG_CHANGE decreased size by 88.55 percent. 
      Compressed is 75 pages; un-compressed would require 655 pages.
NOTE: Table WORK.OBS_STG_CHANGE created, with 26168 rows and 30 columns.

4                                                          The SAS System                        Tuesday, April 28, 2020 12:45:00 PM

100        
101        QUIT;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.21 seconds
      cpu time            0.21 seconds
      

102        
103        
104        %macro makro(korak,broj);
105        DATA CTAge;
106        SET obs_stg_change;
107        step=((1-alpha)/log(50))/(50-1);
108        y= alpha+ &amp;amp;korak*log(Age);
109        IF(I1=1) THEN min_Threshold = min(y,PDThreshold);
110        IF(I2=1) THEN max_Threshold = max(y,PDThreshold);
111        min_max_Threshold=COALESCE(min_Threshold, max_Threshold);
112        IF PDPuncCurr &amp;gt; min_max_Threshold THEN StgChange_CT = 1; ELSE StgChange_CT = 0;
113        RUN;
114        
115        /*0.5757232999 SUM SQUARE*/
116        
117        PROC SQL;
118           CREATE TABLE CTAge_obs&amp;amp;broj AS
119           SELECT &amp;amp;korak AS step, min(t1.sum_StgChange) as sum_StgChange,
120                    (SUM(t1.StgChange_CT)) AS SUM_StgChange_CT, /*a1*//* count # of obs which change stage */
121        /*			(SUM(t1.StgChange_CT) - t1.sum_StgChange) AS PROVERA,*/
122         /*          (SUM(abs(t1.StgChange_CT-t1.StgChange))) AS SUM_StgChange_DIFF,*/	/*Calculate distance between old CT and
122      ! new one */
123        			(SUM((t1.min_max_Threshold-t1.PDThreshold)**2)) AS SSQ2, /*sum of square*/
124        			SQRT(SUM((t1.min_max_Threshold-t1.PDThreshold)**2)) AS dist_prov, /* square root of the distance */
125        			ABS(SUM(t1.StgChange_CT) - min(t1.sum_StgChange)) AS err_stage2, /* Sum of obs which change stage */
126        			ABS(SUM(t1.StgChange_CT)-sum(t1.StgChange))/MIN(t1.no_obs) AS ee
127              FROM WORK.CTAge t1;
128        QUIT;
129        %mend;
130        
131        %macro sqlloop(start,end,step,pocetak,kraj);
132           PROC SQL;
133             %DO i=&amp;amp;start. %TO &amp;amp;end. %BY &amp;amp;step.;
134        	%DO j=&amp;amp;pocetak. %TO &amp;amp;kraj.;
135               %makro(i,j);
136        	   %END;
137             %END;
138           QUIT;
139        %mend;
140        
141        GOPTIONS NOACCESSIBLE;
142        %LET _CLIENTTASKLABEL=;
143        %LET _CLIENTPROCESSFLOWNAME=;
144        %LET _CLIENTPROJECTPATH=;
145        %LET _CLIENTPROJECTPATHHOST=;
146        %LET _CLIENTPROJECTNAME=;
147        %LET _SASPROGRAMFILE=;
148        %LET _SASPROGRAMFILEHOST=;
149        
150        ;*';*";*/;quit;run;
151        ODS _ALL_ CLOSE;
5                                                          The SAS System                        Tuesday, April 28, 2020 12:45:00 PM

152        
153        
154        QUIT; RUN;
155        &lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Apr 2020 12:59:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643583#M192109</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T12:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643587#M192111</link>
      <description>&lt;P&gt;Also, when I run the proposed solution, it looks like it is never ending loop.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 13:11:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643587#M192111</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T13:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643588#M192112</link>
      <description>&lt;P&gt;Replace the sqlloop macro with the data step I posted earlier; you are also having a conceptual mistake in the sqlloop macro. In the macro, you try to wrap the other macro inside a SQL step. Since that macro contains a data step, this will immediately the SQL step on the "outside".&lt;/P&gt;
&lt;P&gt;The data _null_ step does not have that problem, as it just feeds code into the execution queue for later.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 13:12:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643588#M192112</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-28T13:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643595#M192114</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/324644"&gt;@JovanaUniCredit&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Also, when I run the proposed solution, it looks like it is never ending loop.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I am not surprised. This&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do i = 0 to 0.2507245866 by .001;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will run 251 iterations. Multiply that by the 242 steps of the inner loop, you'll get 60742 executions of the macro %makro. If that only needs 1 second for each run, you'll still be waiting for a day.&lt;/P&gt;
&lt;P&gt;I guess you go back to square one and contemplate what you actually want to do.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 13:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643595#M192114</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-28T13:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro errors</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643599#M192115</link>
      <description>&lt;P&gt;Actually, the idea behind this was to add j in order to have better naming for every table, so as to know which table is for which step and how to join them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do You have any suggestion how to change it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code that I wrote is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro makro(korak,broj);&lt;BR /&gt;DATA CTAge;&lt;BR /&gt;SET obs_stg_change;&lt;BR /&gt;step=((1-alpha)/log(50))/(50-1);&lt;BR /&gt;y= alpha+ &amp;amp;korak*log(Age);&lt;BR /&gt;IF(I1=1) THEN min_Threshold = min(y,PDThreshold);&lt;BR /&gt;IF(I2=1) THEN max_Threshold = max(y,PDThreshold);&lt;BR /&gt;min_max_Threshold=COALESCE(min_Threshold, max_Threshold);&lt;BR /&gt;IF PDPuncCurr &amp;gt; min_max_Threshold THEN StgChange_CT = 1; ELSE StgChange_CT = 0;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;/*0.5757232999 SUM SQUARE*/&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE CTAge_obs&amp;amp;broj AS&lt;BR /&gt;SELECT &amp;amp;korak AS step, min(t1.sum_StgChange) as sum_StgChange,&lt;BR /&gt;(SUM(t1.StgChange_CT)) AS SUM_StgChange_CT, /*a1*//* count # of obs which change stage */&lt;BR /&gt;/* (SUM(t1.StgChange_CT) - t1.sum_StgChange) AS PROVERA,*/&lt;BR /&gt;/* (SUM(abs(t1.StgChange_CT-t1.StgChange))) AS SUM_StgChange_DIFF,*/ /*Calculate distance between old CT and new one */&lt;BR /&gt;(SUM((t1.min_max_Threshold-t1.PDThreshold)**2)) AS SSQ2, /*sum of square*/&lt;BR /&gt;SQRT(SUM((t1.min_max_Threshold-t1.PDThreshold)**2)) AS dist_prov, /* square root of the distance */&lt;BR /&gt;ABS(SUM(t1.StgChange_CT) - min(t1.sum_StgChange)) AS err_stage2, /* Sum of obs which change stage */&lt;BR /&gt;ABS(SUM(t1.StgChange_CT)-sum(t1.StgChange))/MIN(t1.no_obs) AS ee&lt;BR /&gt;FROM WORK.CTAge t1;&lt;BR /&gt;QUIT;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%makro(0,1);&lt;BR /&gt;%makro(0.001,2);&lt;BR /&gt;%makro(0.0011,3);&lt;BR /&gt;%makro(0.0012,4);&lt;BR /&gt;%makro(0.0013,5);&lt;BR /&gt;%makro(0.0014,6);&lt;BR /&gt;%makro(0.0015,7);&lt;BR /&gt;%makro(0.0016,8);&lt;BR /&gt;%makro(0.0017,9);&lt;BR /&gt;%makro(0.0018,10);&lt;BR /&gt;%makro(0.0019,11);&lt;BR /&gt;%makro(0.002,12);&lt;BR /&gt;%makro(0.0021,13);&lt;BR /&gt;%makro(0.0022,14);&lt;BR /&gt;%makro(0.0023,15);&lt;BR /&gt;%makro(0.0024,16);&lt;BR /&gt;%makro(0.0025,17);&lt;BR /&gt;%makro(0.0026,18);&lt;BR /&gt;%makro(0.0027,19);&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on until the 242. table and:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data bete;&lt;BR /&gt;set ctage_obs:;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do You have any suggestion what would be the best solution instead of writting&amp;nbsp;%makro(x,y); for 242 times?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 13:22:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-errors/m-p/643599#M192115</guid>
      <dc:creator>JovanaUniCredit</dc:creator>
      <dc:date>2020-04-28T13:22:57Z</dc:date>
    </item>
  </channel>
</rss>

