<?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 code logic in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238061#M268301</link>
    <description>&lt;P&gt;It's extremely unlikely that missing values could cause a problem.&amp;nbsp; Here are two other situations that are more likely candidates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(1) Even if DSNAME does not exist, your macro still attempts to extract VARNUM to identify the position of VARNAME.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(2) If DSNAME exists but does not contain VARNAME, your macro still attempts to extract whether VARNAME is numeric or character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would be shocked if SAS even examines the values of VARNAME.&amp;nbsp; The problem almost certainly lies elsewhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Dec 2015 13:56:08 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2015-12-07T13:56:08Z</dc:date>
    <item>
      <title>macro code logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238041#M268299</link>
      <description>&lt;P&gt;&amp;nbsp;A macro that identifies any variables either character or numeric – for which all of the observations are missing values. When this occurs, a warning message is output to the SAS log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro vtype(dsname=, varname=, outputflag=);&lt;BR /&gt;%if %sysfunc(exist(&amp;amp;dsname)) %then %do;&lt;BR /&gt;%let dsid = %sysfunc(open(&amp;amp;dsname)); &lt;BR /&gt;%let varnum = %sysfunc(varnum(&amp;amp;dsid,&amp;amp;varname));&lt;BR /&gt;%let vartyp = %sysfunc(vartype(&amp;amp;dsid,&amp;amp;varnum));&lt;BR /&gt; %if &amp;amp;vartyp = C %then %do;&lt;BR /&gt; %let &amp;amp;outputflag=&amp;amp;vartyp;&lt;BR /&gt; %put &amp;amp;varname=character;&lt;BR /&gt; %end;&lt;BR /&gt;%else %if &amp;amp;vartyp = N %then %do;&lt;BR /&gt; %let &amp;amp;outputflag=&amp;amp;vartyp;&lt;BR /&gt; %put &amp;amp;varname=numeric;&lt;BR /&gt; %end;&lt;BR /&gt; %end;&lt;BR /&gt;%else %put "DSNAME parameter is invalid Please pass appropriate values."; &lt;BR /&gt; %mend vtype;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this my code how can i change it according to my requirment?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2015 10:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238041#M268299</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-12-07T10:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: macro code logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238048#M268300</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can check for missing values using proc sql:&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;select max(&amp;amp;varname) into :max_value from &amp;amp;dsname;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;and afterwards just check the value of the newly created macro variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%if &amp;amp;max_value= or&amp;nbsp; &amp;amp;max_value=. %then %do; %put &amp;amp;varname has only missing values;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2015 12:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238048#M268300</guid>
      <dc:creator>And</dc:creator>
      <dc:date>2015-12-07T12:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: macro code logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238061#M268301</link>
      <description>&lt;P&gt;It's extremely unlikely that missing values could cause a problem.&amp;nbsp; Here are two other situations that are more likely candidates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(1) Even if DSNAME does not exist, your macro still attempts to extract VARNUM to identify the position of VARNAME.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(2) If DSNAME exists but does not contain VARNAME, your macro still attempts to extract whether VARNAME is numeric or character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would be shocked if SAS even examines the values of VARNAME.&amp;nbsp; The problem almost certainly lies elsewhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2015 13:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238061#M268301</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-12-07T13:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: macro code logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238214#M268302</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20809"&gt;@And&lt;/a&gt; thanks my prog runs well, but y aren't u using count instead of max??</description>
      <pubDate>Tue, 08 Dec 2015 05:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238214#M268302</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-12-08T05:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: macro code logic</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238217#M268303</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/20809"&gt;@And&lt;/a&gt; how do i incorporate ur code in my code? am having errors can u give all together??</description>
      <pubDate>Tue, 08 Dec 2015 05:53:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-code-logic/m-p/238217#M268303</guid>
      <dc:creator>RTelang</dc:creator>
      <dc:date>2015-12-08T05:53:42Z</dc:date>
    </item>
  </channel>
</rss>

