Help using Base SAS procedures

proc dataset / proc contents

Accepted Solution Solved
Reply
Valued Guide
Posts: 858
Accepted Solution

proc dataset / proc contents

I am currently using this: proc datasets lib=tran1214 nolist;contents data=_all_ noprint out=MDJ.tran1214;quit;run;

I can search the output to find a table that has one or several variables that I need to use.  There is one table that has a corrupted table so it will not work.  I would like to do something like this (this does not work)

proc datasets lib=wbdw nolist;

contents data = ABS_02PORTFOLIO_CONVERSION  ;

contents data = ACLS_CONCENTRATION_FACT  ;

contents data = ACLS_CUSTOMER_DIMENSION  ;

contents data = ACLS_LOAN_DIMENSION  ;

contents data = AGENDA_ACTIVITY_DIM  ;

contents data = AGENDA_ATTEND_FACT  ;

contents data = AGENDA_CONTACT_FACT  ;

currently I'm taking this output with several hundred tables and putting it into excel to search for variables.  Is there a way to list multiple datasets rather than _all_?

I'm using the output to feed into this:

proc sql;

     create table WANT as

     select DISTINCT MEMNAME

     from &check_lib

     where    

/*MEMNAME in (select distinct MEMNAME from &check_lib where upcase(NAME)="ACCT_PARTICIPATED_AMT") AND*/

/*MEMNAME in (select distinct MEMNAME from &check_lib where upcase(NAME)="ACCT_CUST_INTEREST_BAL_AMT") AND*/

/*MEMNAME in (select distinct MEMNAME from &check_lib where upcase(NAME)="ACCT_FEE_CURRENT_PAYOFF_AMT") AND*/

/*memname in (select distinct MEMNAME from &check_lib where upcase(NAME) contains "DEFAULT_DATE_END") AND*/

MEMNAME in (select distinct MEMNAME from &check_lib where upcase(NAME) contains "PD");

quit;

I've tried a few things with no viable solutions, any help will be appreciated.

Thanks in advance.


Accepted Solutions
Solution
‎04-09-2015 05:14 PM
Super User
Posts: 10,516

Re: proc dataset / proc contents

You want to use your SQL on the special SAS DICTIONARY.COLUMNS.

Use this to see the description:

proc sql;

describe table dictionary.columns;

quit;

and then something search the dictionary table to find the memnames with the columns you need. Specify the LIBNAME='YOURLIBGOESHERE' in the where clause.

you could drop all of the UPCASE functions as the LIBNAME, MEMNAME and NAME variables are all upper case in the dictionary tables.

View solution in original post


All Replies
Solution
‎04-09-2015 05:14 PM
Super User
Posts: 10,516

Re: proc dataset / proc contents

You want to use your SQL on the special SAS DICTIONARY.COLUMNS.

Use this to see the description:

proc sql;

describe table dictionary.columns;

quit;

and then something search the dictionary table to find the memnames with the columns you need. Specify the LIBNAME='YOURLIBGOESHERE' in the where clause.

you could drop all of the UPCASE functions as the LIBNAME, MEMNAME and NAME variables are all upper case in the dictionary tables.

Valued Guide
Posts: 858

Re: proc dataset / proc contents

Thanks

Trusted Advisor
Posts: 2,113

Re: proc dataset / proc contents

Just delete the corrupted table.

☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 396 views
  • 0 likes
  • 3 in conversation