<?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 Searching in which tables a column is used in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859442#M42298</link>
    <description>&lt;P&gt;I have many tables and I am searching for a column. I have the name of the column but I dont know in which table it is. How can I find this table/ the tables?&lt;/P&gt;</description>
    <pubDate>Fri, 17 Feb 2023 19:48:27 GMT</pubDate>
    <dc:creator>jozumhannes</dc:creator>
    <dc:date>2023-02-17T19:48:27Z</dc:date>
    <item>
      <title>Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859442#M42298</link>
      <description>&lt;P&gt;I have many tables and I am searching for a column. I have the name of the column but I dont know in which table it is. How can I find this table/ the tables?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 19:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859442#M42298</guid>
      <dc:creator>jozumhannes</dc:creator>
      <dc:date>2023-02-17T19:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859447#M42299</link>
      <description>&lt;P&gt;Assuming you know the name of the SAS Library that the table is in (could be WORK library or could be some other library or database)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table want as select * from dictionary.columns where
        lowcase(name)="fredflintstone" and lowcase(libname)="libraryname";
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Naturally, where it says fredflintstone, you put the name of the variable you are looking for. This creates a SAS data set named WANT with every occurrence of this variable in the library or database of interest. in the column called MEMNAME, that is the name of the data set or table that contains the variable.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 19:50:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859447#M42299</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-17T19:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859455#M42301</link>
      <description>First of all, thank you for your fast reply. I tried this one but I could not get the tables. I just got other column names.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Feb 2023 19:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859455#M42301</guid>
      <dc:creator>jozumhannes</dc:creator>
      <dc:date>2023-02-17T19:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859456#M42302</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/439669"&gt;@jozumhannes&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;First of all, thank you for your fast reply. I tried this one but I could not get the tables. I just got other column names.&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand what you mean. Please show me the LOG from your code (all of it, every single line) and the output.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 20:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859456#M42302</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-17T20:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859459#M42303</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the tables where the columns are.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 20:12:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859459#M42303</guid>
      <dc:creator>jozumhannes</dc:creator>
      <dc:date>2023-02-17T20:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859461#M42304</link>
      <description>&lt;P&gt;the variable name and the table name have to be in lower case, the way I programmed it&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 20:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859461#M42304</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-17T20:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859463#M42305</link>
      <description>I wrote it in lower case right now, but I am always getting the same output.&lt;BR /&gt;And can I use sasapptest as libname?</description>
      <pubDate>Fri, 17 Feb 2023 20:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859463#M42305</guid>
      <dc:creator>jozumhannes</dc:creator>
      <dc:date>2023-02-17T20:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859470#M42306</link>
      <description>&lt;P&gt;You should show the log from running your code, copy the code and all notes, messages or warning from the log, open a text box on the forum with the &amp;lt;/&amp;gt; icon above the message window and paste the text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since Library names are generally restricted to 8 characters I am suspicious of any library named sasapptest .&lt;/P&gt;
&lt;P&gt;If the the libname is active in your current session you should be able to use it.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 20:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859470#M42306</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-17T20:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859473#M42307</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/439669"&gt;@jozumhannes&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I wrote it in lower case right now, but I am always getting the same output.&lt;BR /&gt;And can I use sasapptest as libname?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is never helpful to tell us it didn't work and then provide no other information. SHOW US THE LOG!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 21:25:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859473#M42307</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-17T21:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859481#M42308</link>
      <description>&lt;P&gt;Library reference names are limited to 8 characters, so sasapptest is not valid. I suspect it is your server context.&lt;/P&gt;
&lt;P&gt;If you do not want to restrict the search to a specific library, omit this particular part of the WHERE.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 22:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859481#M42308</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-02-17T22:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859491#M42311</link>
      <description>&lt;P&gt;Basically repeating the code already provided - but eventually in a form that's easier to use for you.&lt;/P&gt;
&lt;P&gt;Just populate macro variable &amp;amp;column_to_search with the name of the variable you want to search.&lt;/P&gt;
&lt;P&gt;Please note: This syntax will only search in tables that are assigned via a libref (libname statement).&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%let column_to_search=age;
proc sql;
  select libname, memname, name
  from dictionary.columns
  where upcase(name)="%upcase(&amp;amp;column_to_search)"
  order by libname, memname
  ;
quit;&lt;/LI-CODE&gt;
&lt;P&gt;If above code doesn't return the result you're after then you need to SHOW us what you get and what you would like to get.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 01:02:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859491#M42311</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-18T01:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859501#M42312</link>
      <description>&lt;P&gt;So you want to see what datasets have a particular variable?&lt;/P&gt;
&lt;P&gt;How many datasets do you have?&amp;nbsp; Where are they?&amp;nbsp; Do you have active libref's pointing to the directory where the datasets are stored?&amp;nbsp; Or perhaps have librefs pointing to the external databases that have "tables" you want to reference as if they were datasets?&amp;nbsp; If not then you will need to first get access to the datasets before you can check which variables they have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;Search for variables with the name BALANCE in the datasets in the physical directory named /myfiles .&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mylib '/myfiles';
proc sql;
create table found as
  select * from dictionary.columns
  where libname='MYLIB'
     and upcase(name) = 'BALANCE'
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Feb 2023 02:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859501#M42312</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-02-18T02:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859873#M42332</link>
      <description>&lt;P&gt;I found a column in DI Studio. But in the DI Studio, you can not see in which dataset this column is used. So, thats why, I want to find the dataset in which this column is used.&lt;BR /&gt;&lt;BR /&gt;Just for my information: Is by variable meant column?&lt;BR /&gt;&lt;BR /&gt;And &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;: I tried your Code. I think you understood me. But this Code doesnt work, I am getting following in the Log:&lt;BR /&gt;*NOTE: Table WORK.FOUND created, with 0 rows and 18 columns.*&lt;BR /&gt;&lt;BR /&gt;And another question would be: I have many libraries. I dont know which one to take. Is there a way in which SAS goes through all the libraries?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 09:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859873#M42332</guid>
      <dc:creator>jozumhannes</dc:creator>
      <dc:date>2023-02-21T09:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859876#M42334</link>
      <description>&lt;P&gt;When searching for libraries and datasets in the DICTIONARY tables, their names must be all uppercase.&lt;/P&gt;
&lt;P&gt;Variable (column) names can be mixed case, so it is always a good idea to use the UPCASE function when searching for a name where you can't be sure how it was written.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DICTIONARY tables are pseudo-tables created dynamically every time you access them, by reading the header pages of the dataset files. If you can't make a restriction with regard to library or dataset name, SAS will read all datasets in all currently assigned libraries, which can (and will) take some time.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 09:55:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/859876#M42334</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-02-21T09:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/860275#M42343</link>
      <description>&lt;P&gt;Doing something similar to the following code should create a data set (WORK.LIST) with two variables, listing the data set containing the variable name you are searching for, and in what library the data set is located. You just need to substitute 'VARNAME' with the actual name of your variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table list (keep= libname memname) as select * &lt;BR /&gt;from dictionary.columns where&lt;BR /&gt;upcase(name)="VARNAME";&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 19:20:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/860275#M42343</guid>
      <dc:creator>jebjur</dc:creator>
      <dc:date>2023-02-22T19:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/860281#M42344</link>
      <description>Is it possibly this is an intermediate column that gets renamed/recoded later on and then dropped? Are all your intermediate tables stored in your jobs/processes?</description>
      <pubDate>Wed, 22 Feb 2023 19:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/860281#M42344</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-02-22T19:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Searching in which tables a column is used</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/860282#M42345</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/439669"&gt;@jozumhannes&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I found a column in DI Studio. But in the DI Studio, you can not see in which dataset this column is used. So, thats why, I want to find the dataset in which this column is used.&lt;BR /&gt;&lt;BR /&gt;Just for my information: Is by variable meant column?&lt;BR /&gt;&lt;BR /&gt;And &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;: I tried your Code. I think you understood me. But this Code doesnt work, I am getting following in the Log:&lt;BR /&gt;*NOTE: Table WORK.FOUND created, with 0 rows and 18 columns.*&lt;BR /&gt;&lt;BR /&gt;And another question would be: I have many libraries. I dont know which one to take. Is there a way in which SAS goes through all the libraries?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not sure about how DI studio works.&amp;nbsp; If you want to check for variable names in datasets then you need access to the datasets.&amp;nbsp; PROC CONTENTS works on either a single dataset or a single library of datasets.&amp;nbsp; But the DICTIONARY.COLUMNS metadata table (which you also see as SASHELP.COLUMN view) has the variable names of all of the datasets in all of the currently active libraries.&amp;nbsp; So as long as your SAS session has access to all of the libraries you wont to search you can use that.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select libname,memname,name,type,length,format,informat,label
from dictionary.columns
where upcase(name)="MYVAR"
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will get 0 observations if no matches are found.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE:&amp;nbsp; A report or some data integration step might USE a variable, but a dataset just HAS variables.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 19:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Searching-in-which-tables-a-column-is-used/m-p/860282#M42345</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-02-22T19:28:13Z</dc:date>
    </item>
  </channel>
</rss>

