<?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 count comman variables in work libraray in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/count-comman-variables-in-work-libraray/m-p/719328#M222724</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	data ds;
	set sahelp.class;
	run;

	
	data ds1;
	set sashelp.class;
	run;


 proc sql;
	select Name,count(Name) 
	from dictionary.columns
	where libname='WORK'
	group by name
	having count(Name)&amp;gt;2;
	quit;

	
	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;no output&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want output comman variables count in work libraray&lt;/P&gt;</description>
    <pubDate>Mon, 15 Feb 2021 13:09:19 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2021-02-15T13:09:19Z</dc:date>
    <item>
      <title>count comman variables in work libraray</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-comman-variables-in-work-libraray/m-p/719328#M222724</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	data ds;
	set sahelp.class;
	run;

	
	data ds1;
	set sashelp.class;
	run;


 proc sql;
	select Name,count(Name) 
	from dictionary.columns
	where libname='WORK'
	group by name
	having count(Name)&amp;gt;2;
	quit;

	
	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;no output&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want output comman variables count in work libraray&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 13:09:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-comman-variables-in-work-libraray/m-p/719328#M222724</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2021-02-15T13:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: count comman variables in work libraray</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-comman-variables-in-work-libraray/m-p/719330#M222726</link>
      <description>&lt;P&gt;I'm not quite sure I understand why you're counting variables. Could you explain? The code below will return common variables between data sets, but that doesn't seem to be what you want according to your post.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: I meant to use the intersect operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	select
				name
	from
				dictionary.columns
	where
				libname = "WORK"	and
				memname = "DS"
	intersect
	select
				name
	from
				dictionary.columns
	where	
				libname = "WORK" 	and
				memname = "DS1";
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 13:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-comman-variables-in-work-libraray/m-p/719330#M222726</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-02-15T13:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: count comman variables in work libraray</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-comman-variables-in-work-libraray/m-p/719331#M222727</link>
      <description>&lt;P&gt;Your first DATA step is not executing because you misspelled "sashelp" as "sahelp". First, correct that.&lt;/P&gt;
&lt;P&gt;Next, your SQL query asks for rows where the count is &amp;gt;2. Because you only have 2 data sets created, no rows meet the criteria, so no output.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;With the code corrected:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
	set sashelp.class;
run;

data ds1;
	set sashelp.class;
run;

 proc sql;
select Name,count(Name) 
	from dictionary.columns
	where libname='WORK'
	group by name
	having count(Name)&amp;gt;=2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You get results:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure SQL: Query Results" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l b header" scope="col"&gt;Column Name&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Age&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Height&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Name&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Sex&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Weight&lt;/TD&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 15 Feb 2021 13:31:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-comman-variables-in-work-libraray/m-p/719331#M222727</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2021-02-15T13:31:32Z</dc:date>
    </item>
  </channel>
</rss>

