<?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 SAS base query in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-base-query/m-p/356014#M83423</link>
    <description>&lt;P&gt;DATA CLASS;&lt;BR /&gt;SET SASHELP.CLASS;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;%macro checkds(dsn);&lt;BR /&gt;%if %sysfunc(exist(&amp;amp;dsn)) %then %do;&lt;BR /&gt;data _null_;&lt;BR /&gt;file print;&lt;BR /&gt;put #3 @10 "Data set &amp;amp;dsn. does exist"; ;&lt;BR /&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;data _null_;&lt;BR /&gt;file print;&lt;BR /&gt;put #3 @10 "Data set &amp;amp;dsn. does not exist";&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend checkds;&lt;BR /&gt;%checkds(WORK.CLASS);&lt;BR /&gt;%checkds(WORK.CLASS4);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I know how to put the info and message into a dataset? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset &amp;nbsp; &amp;nbsp; &amp;nbsp; Message&lt;/P&gt;&lt;P&gt;Class &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Data set Class does exist&lt;/P&gt;&lt;P&gt;Class4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Data set Class4 does not exist&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2017 15:49:26 GMT</pubDate>
    <dc:creator>scb</dc:creator>
    <dc:date>2017-05-04T15:49:26Z</dc:date>
    <item>
      <title>SAS base query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-base-query/m-p/356014#M83423</link>
      <description>&lt;P&gt;DATA CLASS;&lt;BR /&gt;SET SASHELP.CLASS;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;%macro checkds(dsn);&lt;BR /&gt;%if %sysfunc(exist(&amp;amp;dsn)) %then %do;&lt;BR /&gt;data _null_;&lt;BR /&gt;file print;&lt;BR /&gt;put #3 @10 "Data set &amp;amp;dsn. does exist"; ;&lt;BR /&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;data _null_;&lt;BR /&gt;file print;&lt;BR /&gt;put #3 @10 "Data set &amp;amp;dsn. does not exist";&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend checkds;&lt;BR /&gt;%checkds(WORK.CLASS);&lt;BR /&gt;%checkds(WORK.CLASS4);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I know how to put the info and message into a dataset? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset &amp;nbsp; &amp;nbsp; &amp;nbsp; Message&lt;/P&gt;&lt;P&gt;Class &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Data set Class does exist&lt;/P&gt;&lt;P&gt;Class4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Data set Class4 does not exist&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 15:49:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-base-query/m-p/356014#M83423</guid>
      <dc:creator>scb</dc:creator>
      <dc:date>2017-05-04T15:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS base query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-base-query/m-p/356021#M83430</link>
      <description>&lt;P&gt;Depends upon what you are trying to do. Are you trying to do something like the following?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro checkds(dsn);
  %if %sysfunc(exist(&amp;amp;dsn)) %then 
   %let result=catx(' ','Data set',"&amp;amp;dsn.",'does exist');
  %else %let result=catx(' ','Data set',"&amp;amp;dsn.",'does not exist');
  &amp;amp;result.;
%mend checkds;

data test;
  x=%checkds(WORK.CLASS);
  output;
  x=%checkds(WORK.CLASS4);
  output;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2017 16:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-base-query/m-p/356021#M83430</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-04T16:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS base query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-base-query/m-p/356025#M83432</link>
      <description>&lt;P&gt;You can use the EXIST function in a data step.&amp;nbsp; So the only issue is how to get the dataset name from a macrovar as an argument:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dsnlist=sashelp.class sashelp.class2;

data status;
  length dsn $44;
  do w=1 to countw("&amp;amp;dsnlist",' ');
    dsn=scan("&amp;amp;dsnlist",w,' ');
    dsnstatus=exist(dsn);
    output;
  end;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 May 2017 16:13:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-base-query/m-p/356025#M83432</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-05-04T16:13:09Z</dc:date>
    </item>
  </channel>
</rss>

