<?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: Dynamic Libname? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3286#M1450</link>
    <description>That works where you have differently named tables in the libraries making up the concatenated assignment, but the correspondent specifically asked for different libraries and tables of the same name.&lt;BR /&gt;
&lt;BR /&gt;
The rules for accessing objects in concatenated libraries will apply, and only the table from the first library will be surfaced.&lt;BR /&gt;
&lt;BR /&gt;
Which is a shame because it does present an otherwise neat solution.&lt;BR /&gt;
&lt;BR /&gt;
Kind regards&lt;BR /&gt;
&lt;BR /&gt;
David</description>
    <pubDate>Wed, 06 Jun 2007 03:13:55 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-06-06T03:13:55Z</dc:date>
    <item>
      <title>Dynamic Libname?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3282#M1446</link>
      <description>Hello All,&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to find a shorcut around the following. I'm producing a sales report that spans several months, the months will change depending on client request, but the data is structured so each months purchases are on a different dataset...as shown below by my current Libname:&lt;BR /&gt;
&lt;BR /&gt;
libname a '/data/2006/05/';&lt;BR /&gt;
libname b '/data/2006/06/';&lt;BR /&gt;
libname c '/data/2006/07/';&lt;BR /&gt;
&lt;BR /&gt;
I then pull these with a quick datastep&lt;BR /&gt;
&lt;BR /&gt;
data one;&lt;BR /&gt;
set&lt;BR /&gt;
a.file&lt;BR /&gt;
b.file&lt;BR /&gt;
c.file&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Is there a short cut or any way of creating a macro to allow me to pick a date range so I won't have to hard code more libnames with each passing month?  Thanks!&lt;BR /&gt;
&lt;BR /&gt;
Jose</description>
      <pubDate>Thu, 31 May 2007 14:41:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3282#M1446</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-05-31T14:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Libname?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3283#M1447</link>
      <description>Jose,&lt;BR /&gt;
&lt;BR /&gt;
  This question is perhaps best answered by Technical Support.  You can submit it online at &lt;A href="http://support.sas.com/ctx/supportform/index.jsp" target="_blank"&gt;http://support.sas.com/ctx/supportform/index.jsp&lt;/A&gt; .&lt;BR /&gt;
&lt;BR /&gt;
 -- David Kelley, SAS</description>
      <pubDate>Fri, 01 Jun 2007 12:38:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3283#M1447</guid>
      <dc:creator>David_SAS</dc:creator>
      <dc:date>2007-06-01T12:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Libname?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3284#M1448</link>
      <description>I don't think to be smarter than Technical Support, but I was thinking that perhaps you could use a macro, like the following:&lt;BR /&gt;
&lt;BR /&gt;
%macro SalesRepPerMonth(StartMonth,StopMonth);&lt;BR /&gt;
  %local i;&lt;BR /&gt;
  * Create empty dataset;&lt;BR /&gt;
  proc sql;&lt;BR /&gt;
    create table work.SalesRepTot(Month char(2));&lt;BR /&gt;
  quit;&lt;BR /&gt;
  * Loop over the months and simultaneously fill the variable Month;&lt;BR /&gt;
  %do i = &amp;amp;StartMonth %to StopMonth;&lt;BR /&gt;
    %put i = *i.; * Show the value of i in the Log;&lt;BR /&gt;
    libname a "data/2006/&amp;amp;i./";&lt;BR /&gt;
    data work.SalesRepTot; set work.SalesRepTot a.MyMonthFile;&lt;BR /&gt;
      Month = &amp;amp;i.;&lt;BR /&gt;
    run;&lt;BR /&gt;
    libname a clear;&lt;BR /&gt;
  %end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%SalesRepPerMonth(01,12);&lt;BR /&gt;
&lt;BR /&gt;
This macro is easy to expand. It could include year as parameter. Or you could include a call to another macro which would create the actual sales report (as a HTML-file?). Hope this helps. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 04 Jun 2007 13:23:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3284#M1448</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-06-04T13:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Libname?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3285#M1449</link>
      <description>A libname can be something of the form:&lt;BR /&gt;
&lt;BR /&gt;
LIBNAME x ('c:\dir1', 'c:\dir2',  ..., 'c:\dirn');&lt;BR /&gt;
So: LIBNAME x ('c:\data\2006\05', 'c:\data\2006\06', 'c:\data\2006\07');&lt;BR /&gt;
&lt;BR /&gt;
Or you do something like:&lt;BR /&gt;
&lt;BR /&gt;
DATA _NULL_;&lt;BR /&gt;
LENGTH dir dirs $ 300; &lt;BR /&gt;
DO yr = 2001 TO 2003; * year directory ;&lt;BR /&gt;
DO m = 1 TO 12;          * month directory;&lt;BR /&gt;
dir = Quote(Trimn('c:\data\' ||Put(yr,4.0)||'\'||Put(m,z.2)));&lt;BR /&gt;
IF dirs EQ '' THEN dirs = Trimn(dir);&lt;BR /&gt;
ELSE dirs = Trimn(dirs) || ',' ||Trimn(dir) ;&lt;BR /&gt;
END;&lt;BR /&gt;
END;&lt;BR /&gt;
Call SymPut('mdirs', dirs);&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
LIBNAME f (&amp;amp;mdirs);&lt;BR /&gt;
&lt;BR /&gt;
DATA x;&lt;BR /&gt;
SET f.file1 f.file2 f.file3;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
Haven't tested this so you might have to spruce it up little, but you should get the idea. In particular, you could adapt the above to read inline data.&lt;BR /&gt;
&lt;BR /&gt;
Depending on the version of SAS you're running, you can also put the name of file directly. But that's another time. Or homework.</description>
      <pubDate>Tue, 05 Jun 2007 19:49:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3285#M1449</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-06-05T19:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Libname?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3286#M1450</link>
      <description>That works where you have differently named tables in the libraries making up the concatenated assignment, but the correspondent specifically asked for different libraries and tables of the same name.&lt;BR /&gt;
&lt;BR /&gt;
The rules for accessing objects in concatenated libraries will apply, and only the table from the first library will be surfaced.&lt;BR /&gt;
&lt;BR /&gt;
Which is a shame because it does present an otherwise neat solution.&lt;BR /&gt;
&lt;BR /&gt;
Kind regards&lt;BR /&gt;
&lt;BR /&gt;
David</description>
      <pubDate>Wed, 06 Jun 2007 03:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Dynamic-Libname/m-p/3286#M1450</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-06-06T03:13:55Z</dc:date>
    </item>
  </channel>
</rss>

