DATA Step, Macro, Functions and more

Physical location of a table

Accepted Solution Solved
Reply
Respected Advisor
Posts: 4,173
Accepted Solution

Physical location of a table

Hi all

That's a follow up question to https://communities.sas.com/message/134147#134147 out of curiousity.

Proc Contents or sashelp.vmember gives us the physical path to a SAS table, eg:
proc sql;
  select * from sashelp.vmember where libname='SASHELP' and memname='CLASS';
quit;

But the path given seems to be the library path. In case of a concatenated library like SASHELP there might be multiple same named tables in different directories (like CLASS).


Do you know about a way to actually determine which table will be used without having to write some code traversing through the concatenated paths looking for the table (eg. some dictionary table giving the path to the table actually used)?

Thanks

Patrick


Accepted Solutions
Solution
‎08-06-2012 10:26 AM
Super User
Posts: 11,343

Re: Physical location of a table

If you want to know about SASHELP.CLASS, for example, why are you using _all_ in proc contents?

use proc contents data=sashelp.class.

My output includes:

Filename C:\Program Files\SAS\SASFoundation\9.2(32-bit)\core\sashelp\class.sas7bdat

View solution in original post


All Replies
Super User
Super User
Posts: 7,039

Re: Physical location of a table

PROC CONTENTS lists the real location in the output with SAS 9.2 on Unix.

Use ODS to get the output of the EngineHost table into a dataset.

Super User
Posts: 10,018

Re: Physical location of a table

"In case of a concatenated library like SASHELP there might be multiple same named tables in different directories (like CLASS)."

If there is a concatenated library which consist of several libraries, then the first appeared library 's CLASS will be used .

We know there can't be two tables have the same name in a same library. So this library's path is actually the table's path.

Ksharp

Respected Advisor
Posts: 4,173

Re: Physical location of a table

@Ksharp

That's exactly my question: How do I get the first occurrence of a table from a  library with concatenated paths WITHOUT writing code traversing through these paths. Let's say SASHELP.CLASS in below listing is the first time used in

'C:\Program Files\SASHome\SASFoundation\9.3\access\sashelp'. Which dictionary table or procedure like Proc Contents would tell me that?

@Tom

Currently I don't have access to SAS9.2 under UNIX. Running the Proc Contents code posted in the other thread with SAS9.3 under Windows gave me first a listing of all the paths and then a listing of all the tables. But it didn't tell me for a specific table where was taken from in these concatenated paths. Are you telling me that the Proc Contents report looks different with SAS9.2 under Unix?


Thanks

Patrick

And this is what I get in my environment:

proc sql;
  select path
  from sashelp.vmember
  where libname='SASHELP' and memname='CLASS' and memtype='DATA'
  ;
quit;


Pathname
--------------------------------------------------------------------------------------------------
( 'C:\Program Files\SASHome\SASFoundation\9.3\nls\en\SASCFG' 'C:\Program                         
Files\SASHome\SASFoundation\9.3\core\sashelp' 'C:\Program                                        
Files\SASHome\SASFoundation\9.3\access\sashelp' 'C:\Program                                      
Files\SASHome\SASFoundation\9.3\af\sashelp' 'C:\Program                                          
Files\SASHome\SASFoundation\9.3\connect\sashelp' 'C:\Program                                     
Files\SASHome\SASFoundation\9.3\creditscrnod\sashelp' 'C:\Program                                
Files\SASHome\SASFoundation\9.3\dmine\sashelp' 'C:\Program                                       
Files\SASHome\SASFoundation\9.3\eis\sashelp' 'C:\Program                                         
Files\SASHome\SASFoundation\9.3\ets\sashelp' 'C:\Program                                         
Files\SASHome\SASFoundation\9.3\forecastmva\sashelp' 'C:\Program                                 
Files\SASHome\SASFoundation\9.3\gis\sashelp' 'C:\Program                                         
Files\SASHome\SASFoundation\9.3\graph\sashelp' 'C:\Program                                       
Files\SASHome\SASFoundation\9.3\hpf\sashelp' 'C:\Program                                         
Files\SASHome\SASFoundation\9.3\iml\sashelp' 'C:\Program                                         
Files\SASHome\SASFoundation\9.3\insight\sashelp' 'C:\Program                                     
Files\SASHome\SASFoundation\9.3\intrnet\sashelp' 'C:\Program                                     
Files\SASHome\SASFoundation\9.3\inttech\sashelp' 'C:\Program                                  


Or using Proc Contents:

proc contents data=sashelp._all_ nods; run;

                                             Directory

                                          Libref  SASHELP
                                          Levels  24 

                                              Level 1

              Engine         V9                                                     
              Physical Name  C:\Program Files\SASHome\SASFoundation\9.3\nls\en\SASCFG
              Filename       C:\Program Files\SASHome\SASFoundation\9.3\nls\en\SASCFG

                                              Level 2

               Engine         V9                                                    
               Physical Name  C:\Program Files\SASHome\SASFoundation\9.3\core\sashelp
               Filename       C:\Program Files\SASHome\SASFoundation\9.3\core\sashelp

                                              Level 3

              Engine         V9                                                      
              Physical Name  C:\Program Files\SASHome\SASFoundation\9.3\access\sashelp
              Filename       C:\Program Files\SASHome\SASFoundation\9.3\access\sashelp
........

                                        Member
       #  Name                          Type      Level  File Size  Last Modified

       1  AC                            CATALOG     2        17408  26 May 2011 05:21:36      
       2  ADOMSG                        DATA       23       164864  26 May 2011 05:43:22      
          ADOMSG                        INDEX                37888  26 May 2011 05:43:22      
       3  ADSMSG                        DATA        2       148480  26 May 2011 05:19:26      
          ADSMSG                        INDEX                37888  26 May 2011 05:19:26    

......

Solution
‎08-06-2012 10:26 AM
Super User
Posts: 11,343

Re: Physical location of a table

If you want to know about SASHELP.CLASS, for example, why are you using _all_ in proc contents?

use proc contents data=sashelp.class.

My output includes:

Filename C:\Program Files\SAS\SASFoundation\9.2(32-bit)\core\sashelp\class.sas7bdat

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 545 views
  • 6 likes
  • 4 in conversation