<?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 Re: PROC SQL question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441075#M282588</link>
    <description>Thank you Novin!!</description>
    <pubDate>Wed, 28 Feb 2018 23:29:46 GMT</pubDate>
    <dc:creator>unnati</dc:creator>
    <dc:date>2018-02-28T23:29:46Z</dc:date>
    <item>
      <title>PROC SQL question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441057#M282582</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create one dataset by combining two dataset. I would like to know how to &amp;nbsp;use PROC SQL to combine two dataset where two variable have same name. Two dataset i have is as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS dataset.JPG" style="width: 420px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18899i745D5CEB9FAD552A/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS dataset.JPG" alt="SAS dataset.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and a table i would like to create is as below. I know how to create this table wit data/set joining in method. but i would like to use PROC SQL&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS dataset.JPG" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18900i7ECB8F1AC33DE5BA/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS dataset.JPG" alt="SAS dataset.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I right SAS code couple of code but i don't understand that what is wrong in my code. &amp;nbsp;Can anyone explain me what is wrong in this code and how i can use PROC SQL to create desire table ???&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql feedback;
create table ab3 as
select groupa,groupb
where groupa.id=groupb.id and groupa.product=group.product;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table ab2 as
select coalesce (groupa.ID, groupb.id)as id, product, size
from groupa full join groupb on groupa.id=groupb.id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 22:28:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441057#M282582</guid>
      <dc:creator>unnati</dc:creator>
      <dc:date>2018-02-28T22:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441059#M282583</link>
      <description>&lt;P&gt;What you need is UNION ALL with an ORDER BY statement like so&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
	infile datalines dlm=",";
	length id $1 product $10;
	input id product;
	datalines;
A,Apple
B,Grapes
B,Orange
C,Banana
E,Apple
;
run;


data two;
	infile datalines dlm=",";
	length id $1 product $10 size $1;
	input id product size;
	datalines;
B,Shirt,S
C,Pants,M
D,jacket,L
E,Tie,M
E,Wallet,L
;
run;

proc sql;
	create table result
	as select *
	from one
	union all
	select *
	from two
	order by id,product;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Feb 2018 22:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441059#M282583</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2018-02-28T22:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441060#M282584</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input id $ product $;
datalines;
A Apple
B Grapes
B Orange
C Banana
E Apple
;

data two;
input id $ product $ size $;
datalines;
B Shirt S
C Pants M
D Jacket L
E Tie M
E Wallet L
;


proc sql;
create table want as
select * from one
   outer union corr
select * from two
order by id,product;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Feb 2018 22:52:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441060#M282584</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-02-28T22:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441066#M282585</link>
      <description>&lt;P&gt;More fun:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input id $ product $;
datalines;
A Apple
B Grapes
B Orange
C Banana
E Apple
;

data two;
input id $ product $ size $;
datalines;
B Shirt S
C Pants M
D Jacket L
E Tie M
E Wallet L
;

proc sql;
create table want as
select COALESCEC(a.id, b.id) as id,COALESCEC(a.product, b.product) as product,size
from one a
full join two b
on  a.id=b.id and a.product=b.product
order by 1,2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Feb 2018 23:07:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441066#M282585</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-02-28T23:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441072#M282586</link>
      <description>&lt;P&gt;Thank you for your help but now i am trying to understand your code i have created same &amp;nbsp;code but with little change, can you please explain me why my code not work &amp;nbsp;and what is difference in process(i know you created some temporary variable but is it necessary to create temp variable )&lt;/P&gt;&lt;P&gt;Following is my code and i get Error message&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* my code*/
 PROC SQL;
 create table me as
 select COALESCEC(Groupa.id, groupb.id) as ID, COALESCEC(groupa.product, groupb.prodcut) as prodcut, size
 from groupa full join groupb 
 on groupa.id=groupb.id and groupa.product=groupb.product
 order by 1,2;
 quit;
 


/*error message*/         
826  proc SQL;
827   create table me as
828   select COALESCEC(Groupa.id, groupb.id) as ID, COALESCEC(groupa.product, groupb.prodcut) as
828! prodcut, size
829   from groupa full join groupb
830   on groupa.id=groupb.id and groupa.product=groupb.product
831   order by 1,2;
ERROR: Column prodcut could not be found in the table/view identified with the correlation name
       GROUPB.
ERROR: Column prodcut could not be found in the table/view identified with the correlation name
       GROUPB.
832   quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 23:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441072#M282586</guid>
      <dc:creator>unnati</dc:creator>
      <dc:date>2018-02-28T23:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441074#M282587</link>
      <description>&lt;P&gt;Thank you Chris!!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 23:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441074#M282587</guid>
      <dc:creator>unnati</dc:creator>
      <dc:date>2018-02-28T23:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441075#M282588</link>
      <description>Thank you Novin!!</description>
      <pubDate>Wed, 28 Feb 2018 23:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441075#M282588</guid>
      <dc:creator>unnati</dc:creator>
      <dc:date>2018-02-28T23:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441102#M282589</link>
      <description>&lt;P&gt;is this a typo error in your code?. Do you really have a column by the name &lt;STRONG&gt;prodcut&lt;/STRONG&gt; rather than &lt;STRONG&gt;product&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;COALESCEC&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;Groupa&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; groupb&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; as &lt;SPAN class="token keyword"&gt;ID&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;COALESCEC&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;groupa&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;product&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; groupb&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;prodcut&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; as prodcut&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; size&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Mar 2018 03:11:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441102#M282589</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-01T03:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441103#M282590</link>
      <description>Thank you so much for bring my attention. Dum me, i have spend my whole day to figure out this code, without realizing spelling error.&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;Unnati</description>
      <pubDate>Thu, 01 Mar 2018 03:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-question/m-p/441103#M282590</guid>
      <dc:creator>unnati</dc:creator>
      <dc:date>2018-03-01T03:16:45Z</dc:date>
    </item>
  </channel>
</rss>

