<?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: How to make a macro resolve to &amp;quot;0&amp;quot; when there's not value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-a-macro-resolve-to-quot-0-quot-when-there-s-not/m-p/747684#M234726</link>
    <description>&lt;P&gt;Put this code before your Proc Report:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%GLOBAL p2;
%IF %BQUOTE(&amp;amp;p2) = %BQUOTE() %THEN
    DO;
        %LET p2 = 0;
    END;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;P.S.&amp;nbsp; The second %BQUOTE isn't, strictly speaking, necessary, but I like it just for code readability.&amp;nbsp; Note that there is NOT a space between the parentheses in the second %BQUOTE.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jun 2021 04:58:45 GMT</pubDate>
    <dc:creator>jimbarbour</dc:creator>
    <dc:date>2021-06-14T04:58:45Z</dc:date>
    <item>
      <title>How to make a macro resolve to "0" when there's not value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-a-macro-resolve-to-quot-0-quot-when-there-s-not/m-p/747681#M234724</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;My macro is not resolving because there is no data for that variable. I tried using data _null_ and set it as "0" values when data does not exist, but no luck. How do I set it to "0" in this situation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HitmonTran_0-1623645176146.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60317iBAEE9F87D95F9FBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HitmonTran_0-1623645176146.png" alt="HitmonTran_0-1623645176146.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; &lt;BR /&gt;proc sql;&lt;BR /&gt;select count(*) into :obs from g3pop;&lt;BR /&gt;quit;&lt;BR /&gt;%put obs: &amp;amp;obs.;&lt;BR /&gt;&lt;BR /&gt;%if &amp;amp;obs &amp;gt; 0 %then %do;  
	proc sql noprint;
	
        *Number/percent of subjects experiencing the events - Toxicity&amp;gt;=3 event;
        select (strip(put(count (distinct usubjid), best.))) into :ng3a1 from g3pop where (trtn=1);            
        select (strip(put(&amp;amp;ng3a1./&amp;amp;trt1.*100, 2.))) into :pg3a1 from g3pop where (trtn=1); 
        select strip(put(&amp;amp;ng3a1., 5.))||' ('||strip(put(&amp;amp;pg3a1., 2.))||'%)' into :a2 from g3pop where (trtn=1);
        
        select (strip(put(count (distinct usubjid), best.))) into :ng3p2 from g3pop where (trtn=2);            
        select (strip(put(&amp;amp;ng3p2./&amp;amp;trt2.*100, 2.))) into :pg3p2 from g3pop where (trtn=2); 
        select strip(put(&amp;amp;ng3p2., 5.))||' ('||strip(put(&amp;amp;pg3p2., 2.))||'%)' into :p2 from g3pop where (trtn=2);
    quit;
%end; &lt;BR /&gt;
%else %do;
	data _null_;
		call symput('p2','0 (0%)');
		call symput('t2','0 (0%)');
		call symput('a2','0 (0%)');
	run;
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jun 2021 04:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-a-macro-resolve-to-quot-0-quot-when-there-s-not/m-p/747681#M234724</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2021-06-14T04:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a macro resolve to "0" when there's not value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-a-macro-resolve-to-quot-0-quot-when-there-s-not/m-p/747684#M234726</link>
      <description>&lt;P&gt;Put this code before your Proc Report:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%GLOBAL p2;
%IF %BQUOTE(&amp;amp;p2) = %BQUOTE() %THEN
    DO;
        %LET p2 = 0;
    END;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;P.S.&amp;nbsp; The second %BQUOTE isn't, strictly speaking, necessary, but I like it just for code readability.&amp;nbsp; Note that there is NOT a space between the parentheses in the second %BQUOTE.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 04:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-a-macro-resolve-to-quot-0-quot-when-there-s-not/m-p/747684#M234726</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-06-14T04:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a macro resolve to "0" when there's not value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-a-macro-resolve-to-quot-0-quot-when-there-s-not/m-p/747695#M234733</link>
      <description>&lt;P&gt;The simplest way would be to add&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let p2=0 (0%);
%let t2=0 (0%);
%let a2=0 (0%);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;before the proc sql. Then the value gets overwritten if available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 06:30:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-a-macro-resolve-to-quot-0-quot-when-there-s-not/m-p/747695#M234733</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-06-14T06:30:46Z</dc:date>
    </item>
  </channel>
</rss>

