<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro/m-p/574845#M162499</link>
    <description>&lt;P&gt;Other than the fact that you seem to be trying to put data into macro variables instead of just keeping the data in real variables in datasets?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the SQL query does not create the macro variable if no observations are selected.&amp;nbsp; Make sure to define them in case of no matches.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
%let rawA&amp;amp;i = ;
%let rawB&amp;amp;i = ;
select rawA&amp;amp;i. into :rawA&amp;amp;i. from conAB&amp;amp;i. where diffA&amp;amp;i.= &amp;amp;&amp;amp;minthetaA&amp;amp;i.;
select rawB&amp;amp;i. into :rawB&amp;amp;i. from conAB&amp;amp;i. where diffB&amp;amp;i.= &amp;amp;&amp;amp;minthetaB&amp;amp;i.;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jul 2019 01:08:02 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-07-19T01:08:02Z</dc:date>
    <item>
      <title>macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro/m-p/574840#M162498</link>
      <description>&lt;P&gt;Hello members,&lt;/P&gt;
&lt;P&gt;Can you please help me find out what's wrong with the red part? Thanks!!!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro cov (cutt,cutc);&lt;BR /&gt;%do i=1 %to 2;&lt;BR /&gt;data covA&amp;amp;i.;&lt;BR /&gt;infile "&amp;amp;pathr.WS1_A.rep&amp;amp;i..sc" FIRSTOBS=3 OBS=43 missover pad;&lt;BR /&gt;input&lt;BR /&gt;rawA&amp;amp;i. 5-6&lt;BR /&gt;thetaA&amp;amp;i. 10-15; &lt;BR /&gt;run; &lt;BR /&gt;data covB&amp;amp;i.;&lt;BR /&gt;infile "&amp;amp;pathr.WS2_B.rep&amp;amp;i..sc" FIRSTOBS=3 OBS=43 missover pad;&lt;BR /&gt;input &lt;BR /&gt;rawB&amp;amp;i. 5-6 &lt;BR /&gt;thetaB&amp;amp;i. 10-15; &lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data conAB&amp;amp;i.;&lt;BR /&gt;merge covA&amp;amp;i. covB&amp;amp;i.;&lt;BR /&gt;diffA&amp;amp;i.=abs(thetaA&amp;amp;i.-&amp;amp;cutt.);&lt;BR /&gt;diffB&amp;amp;i.=abs(thetaB&amp;amp;i.-&amp;amp;cutt.);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc print data=conAB&amp;amp;i.;run;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;select min(abs(thetaA&amp;amp;i.-&amp;amp;cutt.)) into :minthetaA&amp;amp;i. from conAB&amp;amp;i. where thetaA&amp;amp;i.&amp;gt;=0;&lt;BR /&gt;select min(abs(thetaB&amp;amp;i.-&amp;amp;cutt.)) into :minthetaB&amp;amp;i. from conAB&amp;amp;i. where thetaB&amp;amp;i.&amp;gt;=0;&lt;BR /&gt;quit;&lt;BR /&gt;%put minimum thetaA diff is &amp;amp;&amp;amp;minthetaA&amp;amp;i.;&lt;BR /&gt;%put minimum thetaB diff is &amp;amp;&amp;amp;minthetaB&amp;amp;i.;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;proc sql noprint;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;select rawA&amp;amp;i. into :rawA&amp;amp;i. from conAB&amp;amp;i. where diffA&amp;amp;i.= &amp;amp;&amp;amp;minthetaA&amp;amp;i.;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;select rawB&amp;amp;i. into :rawB&amp;amp;i. from conAB&amp;amp;i. where diffB&amp;amp;i.= &amp;amp;&amp;amp;minthetaB&amp;amp;i.;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;%put raw cutA is &amp;amp;&amp;amp;rawA&amp;amp;i.;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;%put raw cutB is &amp;amp;&amp;amp;rawB&amp;amp;i.;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;data cut&amp;amp;cutc.&amp;amp;i.;&lt;BR /&gt;cutrawA=&amp;amp;&amp;amp;rawA&amp;amp;i.;&lt;BR /&gt;cutrawB=&amp;amp;&amp;amp;rawB&amp;amp;i. ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;%if &amp;amp;i=1 %then %do; data cov&amp;amp;cutc.;set cut&amp;amp;cutc.&amp;amp;i.;run;%end;&lt;BR /&gt;%else %do; data cov&amp;amp;cutc.;set cov&amp;amp;cutc. cut&amp;amp;cutc.&amp;amp;i.;run; %end;&lt;/P&gt;
&lt;P&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%cov (cutt=0, cutc=zero); &lt;BR /&gt;%cov (cutt=0.5,cutc=low);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;------------------------- log-----&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;WARNING: Apparent symbolic reference RAWA1 not resolved.&lt;BR /&gt;raw cutA is &amp;amp;rawA1&lt;BR /&gt;WARNING: Apparent symbolic reference RAWB1 not resolved.&lt;BR /&gt;raw cutB is &amp;amp;rawB1&lt;BR /&gt;NOTE: Line generated by the macro variable "I".&lt;BR /&gt;1 &amp;amp;rawA1&lt;BR /&gt;-&lt;BR /&gt;22&lt;BR /&gt;WARNING: Apparent symbolic reference RAWA1 not resolved.&lt;BR /&gt;NOTE: Line generated by the macro variable "I".&lt;BR /&gt;1 &amp;amp;rawB1&lt;BR /&gt;-&lt;BR /&gt;22&lt;BR /&gt;WARNING: Apparent symbolic reference RAWB1 not resolved.&lt;/P&gt;
&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,&lt;BR /&gt;a missing value, INPUT, PUT.&lt;/P&gt;
&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.CUTLOW1 may be incomplete. When this step was stopped there were 0 observations and 4 variables.&lt;BR /&gt;WARNING: Data set WORK.CUTLOW1 was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 01:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro/m-p/574840#M162498</guid>
      <dc:creator>TX_STAR</dc:creator>
      <dc:date>2019-07-19T01:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro/m-p/574845#M162499</link>
      <description>&lt;P&gt;Other than the fact that you seem to be trying to put data into macro variables instead of just keeping the data in real variables in datasets?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the SQL query does not create the macro variable if no observations are selected.&amp;nbsp; Make sure to define them in case of no matches.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
%let rawA&amp;amp;i = ;
%let rawB&amp;amp;i = ;
select rawA&amp;amp;i. into :rawA&amp;amp;i. from conAB&amp;amp;i. where diffA&amp;amp;i.= &amp;amp;&amp;amp;minthetaA&amp;amp;i.;
select rawB&amp;amp;i. into :rawB&amp;amp;i. from conAB&amp;amp;i. where diffB&amp;amp;i.= &amp;amp;&amp;amp;minthetaB&amp;amp;i.;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 01:08:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro/m-p/574845#M162499</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-19T01:08:02Z</dc:date>
    </item>
  </channel>
</rss>

