<?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 sum the size of members for each library in SPDserver environment in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46779#M12480</link>
    <description>Hi.&lt;BR /&gt;
Everyone!&lt;BR /&gt;
I want to know the size of each library in SAS SPDServer environment.&lt;BR /&gt;
Dictionary table 'tables' does not work for SPDServer,but work for Base.&lt;BR /&gt;
So I want to know how to get the size of each library for SPDServer.&lt;BR /&gt;
Can somebody give me some clue?&lt;BR /&gt;
&lt;BR /&gt;
I am using UNIX command through SAS PIPE to achieve it.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
    <pubDate>Wed, 08 Dec 2010 08:54:17 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2010-12-08T08:54:17Z</dc:date>
    <item>
      <title>sum the size of members for each library in SPDserver environment</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46779#M12480</link>
      <description>Hi.&lt;BR /&gt;
Everyone!&lt;BR /&gt;
I want to know the size of each library in SAS SPDServer environment.&lt;BR /&gt;
Dictionary table 'tables' does not work for SPDServer,but work for Base.&lt;BR /&gt;
So I want to know how to get the size of each library for SPDServer.&lt;BR /&gt;
Can somebody give me some clue?&lt;BR /&gt;
&lt;BR /&gt;
I am using UNIX command through SAS PIPE to achieve it.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 08 Dec 2010 08:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46779#M12480</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-12-08T08:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: sum the size of members for each library in SPDserver environment</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46780#M12481</link>
      <description>One way to do it is to use the &lt;I&gt;du&lt;/I&gt; command, together with the path information in the libnames.parm file.&lt;BR /&gt;
&lt;BR /&gt;
If you can settle with less precise values, you could use the formulas in the FAQ section of the Users Guide. &lt;BR /&gt;
Should work pretty well for uncompressed data. &lt;BR /&gt;
If you have compressed data, you have to find out the compression ratio for each table, and add it to the formula.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Wed, 26 Jan 2011 10:27:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46780#M12481</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2011-01-26T10:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: sum the size of members for each library in SPDserver environment</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46781#M12482</link>
      <description>du&lt;BR /&gt;
is platform dependant&lt;BR /&gt;
You might find the finfo() function offers a way of collecting the filesize in a non-"platform dependant" way. I have tested it with the spde engine[pre]&lt;BR /&gt;
libname sp1 spde "%sysget(temp)\spdtemp"  partsize=128;&lt;BR /&gt;
data sp1.test1( index=(row)) ;[/pre]creating some data[pre] row+1;&lt;BR /&gt;
 set sashelp.shoes ;&lt;BR /&gt;
run;[/pre]now access that folder and the physical files in it[pre]filename sp2 "%sysget(temp)\spdtemp"  ;&lt;BR /&gt;
data diropts   ;&lt;BR /&gt;
   length optname  Doptval Moptval  $140 memname $255  ;&lt;BR /&gt;
   did=dopen("sp2");&lt;BR /&gt;
   numopts=doptnum(did);&lt;BR /&gt;
   memcount=dnum(did);&lt;BR /&gt;
   do i=1 to memcount ;&lt;BR /&gt;
      memname = dread( did, i ) ;&lt;BR /&gt;
      mid = mopen( did, memname ) ;&lt;BR /&gt;
      if not mid then continue ;&lt;BR /&gt;
      numopts = foptnum( mid ) ;&lt;BR /&gt;
      do j=1 to numopts ;&lt;BR /&gt;
         optname=foptname(mid,j);&lt;BR /&gt;
         Moptval=finfo(mid,optname);&lt;BR /&gt;
         output ;&lt;BR /&gt;
      end ;&lt;BR /&gt;
   end ;&lt;BR /&gt;
run;[/pre]On my SAS9.2 windows vista platform, the option names/values are[pre]The SAS System                                                  11:35 Saturday, January 22, 2011 1&lt;BR /&gt;
optname              Moptval&lt;BR /&gt;
&lt;BR /&gt;
Filename             C:\Users\PETERC~1\AppData\Local\Temp\spdtemp\test1.dpf.649166ba.0.1.spds9&lt;BR /&gt;
RECFM                V&lt;BR /&gt;
LRECL                256&lt;BR /&gt;
File Size (bytes)    37920&lt;BR /&gt;
Last Modified        26 January 2011 10:51:01 o'clo&lt;BR /&gt;
Create Time          26 January 2011 10:50:38 o'clo&lt;BR /&gt;
Filename             C:\Users\PETERC~1\AppData\Local\Temp\spdtemp\test1.hbxrow.649166ba.0.1.spds9&lt;BR /&gt;
RECFM                V&lt;BR /&gt;
LRECL                256&lt;BR /&gt;
File Size (bytes)    49152&lt;BR /&gt;
Last Modified        26 January 2011 10:51:01 o'clo&lt;BR /&gt;
Create Time          26 January 2011 10:50:38 o'clo&lt;BR /&gt;
Filename             C:\Users\PETERC~1\AppData\Local\Temp\spdtemp\test1.idxrow.649166ba.0.1.spds9&lt;BR /&gt;
RECFM                V&lt;BR /&gt;
LRECL                256&lt;BR /&gt;
File Size (bytes)    8192&lt;BR /&gt;
Last Modified        26 January 2011 10:51:01 o'clo&lt;BR /&gt;
Create Time          26 January 2011 10:50:38 o'clo&lt;BR /&gt;
Filename             C:\Users\PETERC~1\AppData\Local\Temp\spdtemp\test1.mdf.0.0.0.spds9&lt;BR /&gt;
RECFM                V&lt;BR /&gt;
LRECL                256&lt;BR /&gt;
File Size (bytes)    35544&lt;BR /&gt;
Last Modified        26 January 2011 10:51:01 o'clo&lt;BR /&gt;
Create Time          26 January 2011 10:50:38 o'clo</description>
      <pubDate>Wed, 26 Jan 2011 11:42:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46781#M12482</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-01-26T11:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: sum the size of members for each library in SPDserver environment</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46782#M12483</link>
      <description>Hi.&lt;BR /&gt;
I am so surprised that my post will has some answer for the sake of a long time ago.&lt;BR /&gt;
Linus.&lt;BR /&gt;
Actually I do what you have said (i.e. filename + pipe + 'du &amp;amp;pathename').&lt;BR /&gt;
I firstly distil the data path of each library from distionary table(i.e. dictionary.libnames) ,&lt;BR /&gt;
then stack them into a marco variable ( &amp;amp;pathename) by proc sql ( separated by ' '), because command 'du' can support multi path name &lt;BR /&gt;
, now the following thing is more simple to do.&lt;BR /&gt;
&lt;BR /&gt;
Thanks your reply.&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 27 Jan 2011 01:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46782#M12483</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-01-27T01:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: sum the size of members for each library in SPDserver environment</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46783#M12484</link>
      <description>Hi.&lt;BR /&gt;
Peter.C&lt;BR /&gt;
I think your code is right.&lt;BR /&gt;
But we have hundreds of librarys ,It is hard for me to apply the code to the library separately.Fortunately I have solution just as I said in the last post.&lt;BR /&gt;
I also talk to SAS Technology ,they gave me two methods, one of two is very useful which use SPDS API in data step to sum the size of each library.&lt;BR /&gt;
And I post these ,hope to help somebody.&lt;BR /&gt;
[pre]&lt;BR /&gt;
/***&lt;BR /&gt;
/* This program uses the SAS Open Metadata API data step functions to query&lt;BR /&gt;
/* the metadata repository and return a list of all libraries and their&lt;BR /&gt;
/* associated directory or database schema. The results are returned to a&lt;BR /&gt;
/* SAS data set in the WORK library.&lt;BR /&gt;
/* &lt;BR /&gt;
/* Modify the code to generate the results in a form useful to you, such as&lt;BR /&gt;
/* a simple listing via PROC PRINT.&lt;BR /&gt;
/* &lt;BR /&gt;
/* Modify the Meta* options to supply correct connection parameters to the&lt;BR /&gt;
/* metadata server that contains the user information. The METAUSER should&lt;BR /&gt;
/* be a user who has read permission to the metadata objects being queried,&lt;BR /&gt;
/* such as the Unrestricted (e.g. sasadm) user.&lt;BR /&gt;
***/&lt;BR /&gt;
&lt;BR /&gt;
/*Connect to the metadata server*/&lt;BR /&gt;
options metaserver="your.metadata.server"&lt;BR /&gt;
    metaport=8561&lt;BR /&gt;
		metauser="sasadm@saspw"&lt;BR /&gt;
		metapass="sasadmpw"&lt;BR /&gt;
		metarepository="Foundation"&lt;BR /&gt;
		metaprotocol=BRIDGE;&lt;BR /&gt;
&lt;BR /&gt;
/* Begin query to metadata server for SAS Library objects */&lt;BR /&gt;
data metadata_libraries;&lt;BR /&gt;
  length liburi upasnuri $256 name Description $128 type id $17 libref engine $8 path mdschemaname schema $256;&lt;BR /&gt;
  keep name libref engine path mdschemaname schema Description;&lt;BR /&gt;
  call missing(liburi,upasnuri,name,engine,libref,Description);&lt;BR /&gt;
&lt;BR /&gt;
  /* Get each Library object */&lt;BR /&gt;
  nlibobj=1;&lt;BR /&gt;
  librc=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",nlibobj,liburi);&lt;BR /&gt;
&lt;BR /&gt;
  /* For each library, retrieve the libref, engine, path */&lt;BR /&gt;
  do while (librc&amp;gt;0);&lt;BR /&gt;
     /* Get Library attributes */&lt;BR /&gt;
     rc=metadata_getattr(liburi,'Name',name);&lt;BR /&gt;
     rc=metadata_getattr(liburi,'Engine',engine);&lt;BR /&gt;
	 rc=metadata_getattr(liburi,'Libref',libref);&lt;BR /&gt;
	 rc=metadata_getattr(liburi,'Desc',Description);&lt;BR /&gt;
	 &lt;BR /&gt;
	    /* Get the Directory and DatabaseSchema object&lt;BR /&gt;
           associated with this library via a &lt;BR /&gt;
           UsingPackages association*/&lt;BR /&gt;
	    n=1;&lt;BR /&gt;
	    uprc=metadata_getnasn(liburi,'UsingPackages',n,upasnuri);&lt;BR /&gt;
	    /* We found a UsingPackages association */&lt;BR /&gt;
	    if uprc &amp;gt; 0 then do;&lt;BR /&gt;
	       /* Determine object type */&lt;BR /&gt;
	       call missing(type,id,path,mdschemaname,schema);&lt;BR /&gt;
	       rc=metadata_resolve(upasnuri,type,id);&lt;BR /&gt;
           if type='Directory' then do;&lt;BR /&gt;
              /* Get the path and output the record */&lt;BR /&gt;
		      rc=metadata_getattr(upasnuri,'DirectoryName',path);&lt;BR /&gt;
			  output;&lt;BR /&gt;
              end; /*if type='Directory'*/&lt;BR /&gt;
           else if type='DatabaseSchema' then do;&lt;BR /&gt;
              /* Get the schema and output the record */&lt;BR /&gt;
               rc=metadata_getattr(upasnuri,'Name',mdschemaname);&lt;BR /&gt;
               rc=metadata_getattr(upasnuri,'SchemaName',schema);&lt;BR /&gt;
              output;&lt;BR /&gt;
              end; /*if type='DatabaseSchema'*/&lt;BR /&gt;
&lt;BR /&gt;
		    /*Check to see if there are any more Directory objects*/&lt;BR /&gt;
            n+1;&lt;BR /&gt;
            uprc=metadata_getnasn(liburi,'UsingPackages',n,upasnuri);&lt;BR /&gt;
		  end; /*if uprc &amp;gt; 0*/&lt;BR /&gt;
&lt;BR /&gt;
	 /*Look for another library*/&lt;BR /&gt;
	 nlibobj+1;&lt;BR /&gt;
     librc=metadata_getnobj("omsobj:SASLibrary?@Id contains '.'",nlibobj,liburi);&lt;BR /&gt;
  end; /*do while (librc&amp;gt;0)*/&lt;BR /&gt;
run;&lt;BR /&gt;
proc print data=metadata_libraries;&lt;BR /&gt;
	var name description;&lt;BR /&gt;
	run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Or another way ,but it is only suited for a single library.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
libname spdslib sasspds 'class' server=chloeyu.5400 user='chloe' password="xxxxxxx" aclspecial=yes;&lt;BR /&gt;
&lt;BR /&gt;
proc spdo lib=spdslib ;&lt;BR /&gt;
spdscmd 'spdsls -info -s -verbose D:\test\spds\meta';&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
58   proc spdo lib=spdslib ;&lt;BR /&gt;
NOTE: Enter "?;" to get info on all the SPDO commands.&lt;BR /&gt;
      Enter "SPDSMAC;" to get list and setting of all SPD macros.&lt;BR /&gt;
59   spdscmd 'spdsls -info -s -verbose D:\test\spds\meta ';&lt;BR /&gt;
     DPF_SIZE      IDX_SIZE      MDF_SIZE      NUMOBS   OBSLEN  SEGSIZE    PARTSIZE CMP ENC CLM TABLE &lt;BR /&gt;
        760             0         26780          19       40     8192   268435200  NO  NO  NO AA &lt;BR /&gt;
          8             0         26476           1        8     8192    33554432  NO  NO  NO NEW&lt;BR /&gt;
  260000000             0         26552     5000000       52     8192    33552896  NO  NO  NO PP60   &lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: “PROCEDURE SPDO”所用时间（总处理时间）:&lt;BR /&gt;
      实际时间          0.85 秒&lt;BR /&gt;
      CPU 时间          0.01 秒&lt;BR /&gt;
&lt;BR /&gt;
DPF_SIZE is the size of all the dpf files, IDX_SIZE is the index size,  MDF_SIZE is the metadata file size.&lt;BR /&gt;
&lt;BR /&gt;
on spds server host, you can run following code to get a file of the table size list:&lt;BR /&gt;
spdsls -info -s -verbose D:\test\spds\meta &amp;gt; d:\1.txt&lt;BR /&gt;
&lt;BR /&gt;
then you can read the data into SAS and summary to get the library size.&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
BTW. I will have holidays for the sake of  Trandition Spring Festival in China.&lt;BR /&gt;
Maybe I will not appear in this forum for a several days.&lt;BR /&gt;
&lt;BR /&gt;
And Happy New Year to Peter.C.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 27 Jan 2011 01:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46783#M12484</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-01-27T01:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: sum the size of members for each library in SPDserver environment</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46784#M12485</link>
      <description>I didn't suspect that SPDS path information was stored in metadata, since they are not specified when defining a SPDS library. I've done something similar, but with other intentions.&lt;BR /&gt;
&lt;BR /&gt;
Gather the path information from DICTIONARY.LIBANMES is similar as looking in the libnnames.parm file, but seems simpler, which is nice. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
I had overlooked the spdsls command. But I guess that there would be no problem of looping over all your SPDS librefs to get a total result?&lt;BR /&gt;
&lt;BR /&gt;
As a final remark I wonder why this information isn't available via some metadata interface, such as the SPDS libanme engine and/or metadata in SPDS. The methods described here I consider as work-around's.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
&lt;BR /&gt;
Linus</description>
      <pubDate>Thu, 27 Jan 2011 09:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46784#M12485</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2011-01-27T09:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: sum the size of members for each library in SPDserver environment</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46785#M12486</link>
      <description>Agree !&lt;BR /&gt;
Yes. There are need some marcros to hold these which need more code.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 28 Jan 2011 02:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sum-the-size-of-members-for-each-library-in-SPDserver/m-p/46785#M12486</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-01-28T02:46:32Z</dc:date>
    </item>
  </channel>
</rss>

