BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Patrick
Opal | Level 21

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

4 REPLIES 4
Tom
Super User Tom
Super User

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.

Ksharp
Super User

"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

Patrick
Opal | Level 21

@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    

......

ballardw
Super User

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

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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