<?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 set all datasets from library? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734591#M228810</link>
    <description>&lt;P&gt;Another way, without macros and without using the potentially slow dictionary.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output members=MEMBERS; 
proc datasets lib=WORK mt=data;
run;
ods output close;

data _null_;
  set MEMBERS end=LASTOBS;
  if _N_=1 then call execute ('data _V/view=_V; set ');
  call execute(NAME);
  if LASTOBS then call execute(' indsname=_DS; DS=_DS; keep VISIT DS;run;');
run;
      
proc freq;
  tables VISIT;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use variable DS if you want analysis by source (table name).&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;</description>
    <pubDate>Thu, 15 Apr 2021 22:05:39 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-04-15T22:05:39Z</dc:date>
    <item>
      <title>How to set all datasets from library?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734182#M228750</link>
      <description>&lt;P&gt;How set all datasets from one library?&lt;/P&gt;&lt;P&gt;Datasets have different names.&amp;nbsp; I need to keep the Visit variable from all datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Purpose: Understand that how many values the study has under the Visit variable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 10:51:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734182#M228750</guid>
      <dc:creator>VaheMartirosyan</dc:creator>
      <dc:date>2021-04-15T10:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all datasets from library?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734196#M228754</link>
      <description>&lt;P&gt;You could query the dictionary, or the view SASHELP.VCOLUMN, and keep all the entries with LIBNAME= your libname and NAME='VISIT'.&lt;/P&gt;
&lt;P&gt;You might have to use the upcase function, I think not but I might be mistaken.&lt;/P&gt;
&lt;P&gt;Be sure to clear as many libnames as possible beforehand to speed up reading the view.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Edit: LIBNAME=, not MEMNAME= , sorry about that, late day reply..&amp;nbsp; ]&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 21:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734196#M228754</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-15T21:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all datasets from library?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734198#M228755</link>
      <description>Let me try. Thanks</description>
      <pubDate>Thu, 15 Apr 2021 11:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734198#M228755</guid>
      <dc:creator>VaheMartirosyan</dc:creator>
      <dc:date>2021-04-15T11:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all datasets from library?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734202#M228758</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select catx(".",libname,memname) !! " (keep=visit)" into :dsnames separated by " "
from dictionary.columns
where libname = "LIBNAME" and upcase(name) = "VISIT";
quit;

data all;
set &amp;amp;dsnames.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that there is a length limit for macro variables (65535), which might be reached if you have very many datasets with that variable in your library.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 11:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734202#M228758</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-15T11:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to set all datasets from library?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734591#M228810</link>
      <description>&lt;P&gt;Another way, without macros and without using the potentially slow dictionary.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output members=MEMBERS; 
proc datasets lib=WORK mt=data;
run;
ods output close;

data _null_;
  set MEMBERS end=LASTOBS;
  if _N_=1 then call execute ('data _V/view=_V; set ');
  call execute(NAME);
  if LASTOBS then call execute(' indsname=_DS; DS=_DS; keep VISIT DS;run;');
run;
      
proc freq;
  tables VISIT;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use variable DS if you want analysis by source (table name).&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;</description>
      <pubDate>Thu, 15 Apr 2021 22:05:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-all-datasets-from-library/m-p/734591#M228810</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-15T22:05:39Z</dc:date>
    </item>
  </channel>
</rss>

