<?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 to import in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694872#M211958</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260675"&gt;@abdulla&lt;/a&gt;&amp;nbsp; Please try-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year1=1950; %let year2=2020;

proc sql; 
create table comp(keep=gvkey year IND--BLOCK) as
select *
from mydat.abc 
where fyear between &amp;amp;year1 and &amp;amp;year2
order by gvkey, year;
quit;
RUN;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*OR why not in the FROM clause like your example1?*/

%let year1=1950; %let year2=2020;

proc sql; 
create table comp as
select *
from mydat.abc(keep=gvkey year IND--BLOCK)
where fyear between &amp;amp;year1 and &amp;amp;year2
order by gvkey, year;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Oct 2020 14:19:22 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-10-28T14:19:22Z</dc:date>
    <item>
      <title>Proc Sql to import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694867#M211954</link>
      <description>&lt;P&gt;%let year1=1950; %let year2=2020;&lt;/P&gt;&lt;P&gt;proc sql; create table comp as&lt;BR /&gt;select *&lt;BR /&gt;from mydat.abc (keep=gvkey year &amp;nbsp;IND--BLOCK)&lt;BR /&gt;where fyear between &amp;amp;year1 and &amp;amp;year2&lt;BR /&gt;order by gvkey, year;&lt;BR /&gt;quit;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My above code works nicely. But I want to make slight changes like the following but it doesn't give me all the variables from IND to Block&lt;/P&gt;&lt;P&gt;%let year1=1950; %let year2=2020;&lt;/P&gt;&lt;P&gt;proc sql; create table comp as&lt;BR /&gt;select gvkey, year, IND--BLOCK&lt;BR /&gt;from mydat.abc&amp;nbsp;&lt;BR /&gt;where fyear between &amp;amp;year1 and &amp;amp;year2&lt;BR /&gt;order by gvkey, year;&lt;BR /&gt;quit;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;Can anyone tell me how should I use IND--BLOCK and get all the variables between IND and BLOCK following the 2nd example?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 14:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694867#M211954</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2020-10-28T14:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql to import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694872#M211958</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260675"&gt;@abdulla&lt;/a&gt;&amp;nbsp; Please try-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year1=1950; %let year2=2020;

proc sql; 
create table comp(keep=gvkey year IND--BLOCK) as
select *
from mydat.abc 
where fyear between &amp;amp;year1 and &amp;amp;year2
order by gvkey, year;
quit;
RUN;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*OR why not in the FROM clause like your example1?*/

%let year1=1950; %let year2=2020;

proc sql; 
create table comp as
select *
from mydat.abc(keep=gvkey year IND--BLOCK)
where fyear between &amp;amp;year1 and &amp;amp;year2
order by gvkey, year;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 14:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694872#M211958</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-10-28T14:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql to import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694874#M211959</link>
      <description>&lt;P&gt;Hi novinosrin,&lt;BR /&gt;As I showed in my first code, it works. But I don't want to use select*. I want to use select gvkey, year, IND....... Because in my where statement I have the following&amp;nbsp;&lt;/P&gt;&lt;P&gt;and CONSOL='C'&lt;BR /&gt;and INDFMT='INDL'&lt;BR /&gt;and DATAFMT='STD'&lt;BR /&gt;and POPsrc='D'&lt;/P&gt;&lt;P&gt;If I use the 2nd code, it shows that I don't have the above things&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 14:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694874#M211959</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2020-10-28T14:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql to import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694875#M211960</link>
      <description>&lt;P&gt;Okay I am afraid SQL clauses do not accept variable lists. You would have to use dataset options i.e Keep= or Drop= either in the FROM table or CREATE table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 14:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694875#M211960</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-10-28T14:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sql to import</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694877#M211961</link>
      <description>&lt;P&gt;You cannot use variable lists in SQL code. Only in SAS code, like your dataset option.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 14:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sql-to-import/m-p/694877#M211961</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-10-28T14:23:10Z</dc:date>
    </item>
  </channel>
</rss>

