<?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 variable resolved but says variable not initialiesd in next data step? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597851#M172302</link>
    <description>&lt;P&gt;I resolved my problem by adding quotes around like this, CR= "&amp;amp;CR"; But I would like to understand why this happened. If anyone can help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Oct 2019 23:43:22 GMT</pubDate>
    <dc:creator>Ruhi</dc:creator>
    <dc:date>2019-10-18T23:43:22Z</dc:date>
    <item>
      <title>Macro variable resolved but says variable not initialiesd in next data step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597849#M172301</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a macro variable using call symput but I am unable to use its value in next step. I have looked at similar examples but I can't figure out the issue. Any help is very much appreciated. So all other macro varaibles except &amp;amp;CR were provided my macro statement and resolve well and are decoded by fitstats1 data really well but CR is coming as CR1 not resolved. Log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;295 %put &amp;amp;cr;&lt;BR /&gt;SYMBOLGEN: Macro variable CR resolves to CR1&lt;BR /&gt;CR1&lt;BR /&gt;296 options symbolgen;&lt;BR /&gt;297 data fitstats1;&lt;BR /&gt;298 set fitstats1;&lt;BR /&gt;299 id=&amp;amp;id;&lt;BR /&gt;SYMBOLGEN: Macro variable ID resolves to "BZ01"&lt;BR /&gt;300 Landmark=&amp;amp;ldmk;&lt;BR /&gt;SYMBOLGEN: Macro variable LDMK resolves to "L2"&lt;BR /&gt;301 side=&amp;amp;side;&lt;BR /&gt;SYMBOLGEN: Macro variable SIDE resolves to "R"&lt;BR /&gt;302 PushNum=&amp;amp;cycle;&lt;BR /&gt;SYMBOLGEN: Macro variable CYCLE resolves to 1&lt;BR /&gt;303 Model=1;&lt;BR /&gt;304 year=&amp;amp;year;&lt;BR /&gt;SYMBOLGEN: Macro variable YEAR resolves to 2013&lt;BR /&gt;305 CR= &amp;amp;CR;&lt;BR /&gt;SYMBOLGEN: Macro variable CR resolves to CR1&lt;BR /&gt;306 run;&lt;/P&gt;
&lt;P&gt;NOTE: Variable CR1 is uninitialized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set &amp;amp;d2;
if _n_ =1 then call symput("CR",RM);
run;
%put &amp;amp;CR;
ods exclude all;
proc glm data= force1;
	model force= disp /ss3 noint;
	ods output FitStatistics=fitstats1 ParameterEstimates=Pestimate1;
run;
options symbolgen;
data fitstats1;
	set fitstats1;
	id=&amp;amp;id;
	Landmark=&amp;amp;ldmk;
	side=&amp;amp;side;
	PushNum=&amp;amp;cycle;
	Model=1;
	year=&amp;amp;year;
	CR= &amp;amp;CR;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Print of fitstats1&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.FITSTATS1" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Dependent&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;RSquare&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;CV&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;RootMSE&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;DepMean&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;id&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Landmark&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;side&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;PushNum&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;Model&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;year&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;CR&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;CR1&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;force&lt;/TD&gt;
&lt;TD class="r data"&gt;0.988213&lt;/TD&gt;
&lt;TD class="r data"&gt;13.71906&lt;/TD&gt;
&lt;TD class="r data"&gt;1.318715&lt;/TD&gt;
&lt;TD class="r data"&gt;9.612285&lt;/TD&gt;
&lt;TD class="l data"&gt;BZ01&lt;/TD&gt;
&lt;TD class="l data"&gt;L2&lt;/TD&gt;
&lt;TD class="l data"&gt;R&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;2013&lt;/TD&gt;
&lt;TD class="r data"&gt;.&lt;/TD&gt;
&lt;TD class="r data"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 23:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597849#M172301</guid>
      <dc:creator>Ruhi</dc:creator>
      <dc:date>2019-10-18T23:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable resolved but says variable not initialiesd in next data step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597851#M172302</link>
      <description>&lt;P&gt;I resolved my problem by adding quotes around like this, CR= "&amp;amp;CR"; But I would like to understand why this happened. If anyone can help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 23:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597851#M172302</guid>
      <dc:creator>Ruhi</dc:creator>
      <dc:date>2019-10-18T23:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable resolved but says variable not initialiesd in next data step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597852#M172303</link>
      <description>&lt;P&gt;because &amp;amp;CR macro is called outside of data step and is global.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 23:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597852#M172303</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-10-18T23:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable resolved but says variable not initialiesd in next data step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597864#M172308</link>
      <description>Examine the SAS statement generated in each case.&lt;BR /&gt;&lt;BR /&gt;When your program generates:&lt;BR /&gt;&lt;BR /&gt;CR = "CR1" ;&lt;BR /&gt;&lt;BR /&gt;it assigns three-character string to the data step variable CR.&lt;BR /&gt;&lt;BR /&gt;When the program generates:&lt;BR /&gt;&lt;BR /&gt;CR = CR1 ;&lt;BR /&gt;&lt;BR /&gt;the program copies from the nonexistent variable CR1 to CR.</description>
      <pubDate>Sat, 19 Oct 2019 03:28:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597864#M172308</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-10-19T03:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable resolved but says variable not initialiesd in next data step?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597871#M172313</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5397"&gt;@Ruhi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I resolved my problem by adding quotes around like this, CR= "&amp;amp;CR"; But I would like to understand why this happened. If anyone can help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Look at the symbolgen messages for ID, LDMK and SIDE. They all contain the quotes tha are needed where they are used. CR does not contain quotes.&lt;/P&gt;
&lt;P&gt;Since having quotes in macro variables often causes problems, I would define all those variables without quotes and wrap them in double quotes where needed.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2019 04:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-resolved-but-says-variable-not-initialiesd-in/m-p/597871#M172313</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-19T04:57:06Z</dc:date>
    </item>
  </channel>
</rss>

