<?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 and filename referencing - file doesn't exist in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-and-filename-referencing-file-doesn-t-exist/m-p/541727#M149630</link>
    <description>&lt;P&gt;You need a LIBNAME statement, not a FILENAME statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You create a reference to the folder with the files and then use them as LibName.DataSetName&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check if the following works, if not, please post your full log - you may want to check that Phone Number is spelled correctly for example. Usually you don't have spaces in the variable name as well as you're missing the R.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably want to replace it with: 'phone number'n or phoneNumber depending on variable name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname ABC  '/global/home/';


proc sql;
select 	k.ID as A_BBB,
 	r.ID as B_BBB, 
AGE , GENDER, HEIGHT, CITY , &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;PHONE NUMBE&lt;/STRONG&gt;&lt;/FONT&gt;
 
FROM 	ABC.K1 as K,
 	ABC.K2 as R	
ON K.ID eq r.ID;
QUIT;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/230631"&gt;@Dublin187&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;This is a beginner's question&lt;/P&gt;
&lt;P&gt;I am trying to merge 2 SAS datasets into one by ID with a PROC SQL, but it seems that my file reference is wrong.&lt;/P&gt;
&lt;P&gt;The log says that my file doesn't exist.&lt;/P&gt;
&lt;P&gt;Would anybody know what is wrong with this code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname ABC  '/global/home/XXX';

filename K1 '/global/home/XXX.sas7bdat';

filename K2 '/global/home/XXYXX.sas7bdat';

proc sql;
select 	k.ID as A_BBB,
 	r.ID as B_BBB, 
AGE , GENDER, HEIGHT, CITY , PHONE NUMBE
 
FROM 	ABC.K1 as K,
 	ABC.K2 as R	
WHERE K.ID eq r.ID;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Mar 2019 19:47:04 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-03-09T19:47:04Z</dc:date>
    <item>
      <title>proc sql and filename referencing - file doesn't exist</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-and-filename-referencing-file-doesn-t-exist/m-p/541723#M149626</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;This is a beginner's question&lt;/P&gt;&lt;P&gt;I am trying to merge 2 SAS datasets into one by ID with a PROC SQL, but it seems that my file reference is wrong.&lt;/P&gt;&lt;P&gt;The log says that my file doesn't exist.&lt;/P&gt;&lt;P&gt;Would anybody know what is wrong with this code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname ABC  '/global/home/XXX';

filename K1 '/global/home/XXX.sas7bdat';

filename K2 '/global/home/XXYXX.sas7bdat';

proc sql;
select 	k.ID as A_BBB,
 	r.ID as B_BBB, 
AGE , GENDER, HEIGHT, CITY , PHONE NUMBE
 
FROM 	ABC.K1 as K,
 	ABC.K2 as R	
WHERE K.ID eq r.ID;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 09 Mar 2019 19:31:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-and-filename-referencing-file-doesn-t-exist/m-p/541723#M149626</guid>
      <dc:creator>Dublin187</dc:creator>
      <dc:date>2019-03-09T19:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql and filename referencing - file doesn't exist</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-and-filename-referencing-file-doesn-t-exist/m-p/541727#M149630</link>
      <description>&lt;P&gt;You need a LIBNAME statement, not a FILENAME statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You create a reference to the folder with the files and then use them as LibName.DataSetName&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check if the following works, if not, please post your full log - you may want to check that Phone Number is spelled correctly for example. Usually you don't have spaces in the variable name as well as you're missing the R.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably want to replace it with: 'phone number'n or phoneNumber depending on variable name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname ABC  '/global/home/';


proc sql;
select 	k.ID as A_BBB,
 	r.ID as B_BBB, 
AGE , GENDER, HEIGHT, CITY , &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;PHONE NUMBE&lt;/STRONG&gt;&lt;/FONT&gt;
 
FROM 	ABC.K1 as K,
 	ABC.K2 as R	
ON K.ID eq r.ID;
QUIT;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/230631"&gt;@Dublin187&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;This is a beginner's question&lt;/P&gt;
&lt;P&gt;I am trying to merge 2 SAS datasets into one by ID with a PROC SQL, but it seems that my file reference is wrong.&lt;/P&gt;
&lt;P&gt;The log says that my file doesn't exist.&lt;/P&gt;
&lt;P&gt;Would anybody know what is wrong with this code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname ABC  '/global/home/XXX';

filename K1 '/global/home/XXX.sas7bdat';

filename K2 '/global/home/XXYXX.sas7bdat';

proc sql;
select 	k.ID as A_BBB,
 	r.ID as B_BBB, 
AGE , GENDER, HEIGHT, CITY , PHONE NUMBE
 
FROM 	ABC.K1 as K,
 	ABC.K2 as R	
WHERE K.ID eq r.ID;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Mar 2019 19:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-and-filename-referencing-file-doesn-t-exist/m-p/541727#M149630</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-03-09T19:47:04Z</dc:date>
    </item>
  </channel>
</rss>

