<?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: WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470140#M120342</link>
    <description>&lt;P&gt;You probably mean:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

create table step1.earlist_grant_date_earlist_id as
SELECT 
Earlist_grant_date.earliest_filing_id, 
put(min(Earlist_grant_date.publn_date),YYMMDDd10.) as Earlist_grant_date_final
from Step1.Earlist_grant_date as Earlist_grant_date
group by Earlist_grant_date.earliest_filing_id
order by Earlist_grant_date.earliest_filing_id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;into: is for creating macro variables, it uses a different&amp;nbsp;syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jun 2018 22:41:16 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-06-13T22:41:16Z</dc:date>
    <item>
      <title>WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470070#M120308</link>
      <description>&lt;P&gt;hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the following codes to get the min date of a group of data which have same 'earliest_filing_id'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

create table step1.earlist_grant_date_earlist_id as
SELECT 
Earlist_grant_date.earliest_filing_id, 
put(min(Earlist_grant_date.publn_date),YYMMDDd10.) into: Earlist_grant_date_final
from Step1.Earlist_grant_date as Earlist_grant_date
group by Earlist_grant_date.earliest_filing_id
order by Earlist_grant_date.earliest_filing_id
;
quit;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the result shows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;111  proc sql;
112
113  create table step1.earlist_grant_date_earlist_id as
114  SELECT
115  Earlist_grant_date.earliest_filing_id,
116  put(min(Earlist_grant_date.publn_date),YYMMDDd10.) into: Earlist_grant_date_final
117  from Step1.Earlist_grant_date as Earlist_grant_date
118  group by Earlist_grant_date.earliest_filing_id
119  order by Earlist_grant_date.earliest_filing_id
120  ;
&lt;STRONG&gt;WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause.
NOTE: Table STEP1.EARLIST_GRANT_DATE_EARLIST_ID created, with 32123844 rows and 2 columns.&lt;/STRONG&gt;
121  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3:44.20
      cpu time            30.18 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what is the meaning of&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause.
NOTE: Table STEP1.EARLIST_GRANT_DATE_EARLIST_ID created, with 32123844 rows and 2 columns.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;should I&amp;nbsp;rewrite the code to avoid this warning ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 19:57:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470070#M120308</guid>
      <dc:creator>France</dc:creator>
      <dc:date>2018-06-13T19:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470073#M120310</link>
      <description>&lt;P&gt;It means exactly what it says. You don't have the same number of variables before and after INTO. So the SQL using INTO doesn't make any logical sense here.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 19:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470073#M120310</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-06-13T19:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470084#M120315</link>
      <description>&lt;P&gt;thanks for your reply &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but what should I do for it ? could you please give me some suggestions ? I would like to have two columns, one is 'earliest_filing_id', the other is minimum of 'publn_date'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks a lot&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 20:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470084#M120315</guid>
      <dc:creator>France</dc:creator>
      <dc:date>2018-06-13T20:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470092#M120317</link>
      <description>&lt;P&gt;into: is used to create macro variables not tables. In T-SQL I believe INTO was used to create a table. In SAS that's handled with the CREATE TABLE statement at the top of the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

create table step1.earlist_grant_date_earlist_id as
SELECT 
Earlist_grant_date.earliest_filing_id, 
put(min(Earlist_grant_date.publn_date),YYMMDDd10.) as Earliest_grant_date_final
from Step1.Earlist_grant_date as Earlist_grant_date
group by Earlist_grant_date.earliest_filing_id
order by Earlist_grant_date.earliest_filing_id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;earliest has an e in it by the way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: you probably also don't want to use the PUT, instead apply a format. That way it's a SAS date that you can do calculations and groups on and will sort correctly. Otherwise it's a character field that's harder to work with.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;min(Earlist_grant_date.publn_date) as Earliest_grant_date_final format=yymmdd10.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jun 2018 20:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470092#M120317</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-13T20:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470094#M120318</link>
      <description>&lt;P&gt;You need to change two things here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may also got another warning:&amp;nbsp;WARNING: INTO clause is ignored in the CREATE TABLE statement. If your using the INTO for creating macro variables then avoid create table statement. Your macro varibles will not be created if you have create table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your query returns 2 columns, so you need to mention two maco variables name in INTO. If multiple rows are returned then you need to use &lt;STRONG&gt;INTO: Name separated by "," , : Weight separated by ","&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select Name,Weight INTO:Name,:Weight from sashelp.class
where name='James'
;
quit;

%PUT "Weight for &amp;amp;Name id &amp;amp;Weight";

proc sql;
select Name,Weight INTO:Name separated by ',',:Weight separated by ',' from sashelp.class
;
quit;

%PUT " &amp;amp;Name and respective weights &amp;amp;Weight";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 20:17:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470094#M120318</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-06-13T20:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470140#M120342</link>
      <description>&lt;P&gt;You probably mean:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

create table step1.earlist_grant_date_earlist_id as
SELECT 
Earlist_grant_date.earliest_filing_id, 
put(min(Earlist_grant_date.publn_date),YYMMDDd10.) as Earlist_grant_date_final
from Step1.Earlist_grant_date as Earlist_grant_date
group by Earlist_grant_date.earliest_filing_id
order by Earlist_grant_date.earliest_filing_id
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;into: is for creating macro variables, it uses a different&amp;nbsp;syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 22:41:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470140#M120342</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-06-13T22:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: INTO clause specifies fewer host variables than columns listed in the SELECT clause.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470159#M120351</link>
      <description>&lt;P&gt;To change (or supply) a name for the column you can just list it after the column spec, or prefix it with AS keyword..&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table step1.earlist_grant_date_earlist_id as
SELECT 
  Earlist_grant_date.earliest_filing_id
, put(min(Earlist_grant_date.publn_date),YYMMDDd10.) AS Earlist_grant_date_final
from Step1.Earlist_grant_date as Earlist_grant_date
group by Earlist_grant_date.earliest_filing_id
order by Earlist_grant_date.earliest_filing_id
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;INTO is for creating macro variables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 00:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-INTO-clause-specifies-fewer-host-variables-than-columns/m-p/470159#M120351</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-06-14T00:41:27Z</dc:date>
    </item>
  </channel>
</rss>

