<?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: Libref not assigned in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/769848#M244134</link>
    <description>&lt;P&gt;and your paths don't look right as well.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1632388684840.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63989i2493888533160F6C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1632388684840.png" alt="Patrick_0-1632388684840.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Sep 2021 09:18:14 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-09-23T09:18:14Z</dc:date>
    <item>
      <title>Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/769809#M244123</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro file_yr (year=year);

libname e "C:Location\Folder";

%let e_file = C:Location of data\Folder of data;

data e.nameoffile;

infile "e_file\nameoffile.txt" 

%mend;

proc sql;
select count(*) as N from e.nameoffile;
Quit;&lt;BR /&gt;&lt;BR /&gt;log:&lt;BR /&gt;ERROR: File e.nameoffile.DATA does not exist.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Hello, how do I make sure this runs?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 08:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/769809#M244123</guid>
      <dc:creator>leeleelee</dc:creator>
      <dc:date>2021-09-23T08:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/769844#M244132</link>
      <description>You are missing a semicolon after your file path on infile statement</description>
      <pubDate>Thu, 23 Sep 2021 09:06:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/769844#M244132</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-09-23T09:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/769848#M244134</link>
      <description>&lt;P&gt;and your paths don't look right as well.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1632388684840.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63989i2493888533160F6C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1632388684840.png" alt="Patrick_0-1632388684840.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 09:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/769848#M244134</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-09-23T09:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/769852#M244138</link>
      <description>To refer to the macro variable in the INFILE statement, refer to &amp;amp;efile, not efile.&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Sep 2021 09:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/769852#M244138</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-09-23T09:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770046#M244236</link>
      <description>&lt;P&gt;The lack of a semicolon does not matter in my case, I'll provide more code/context:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro file_yr (year=year);
libname e "C:\Location\Folder";
%let e_file = C:\Location of data\Folder of data;

data e.nameoffile;

infile "&amp;amp;e_file.\nameoffile.txt" 
firstobs = 2 dlm = "|" lrecl=32767 missover truncover dsd;
/* inserted input and format for headers here*/
%mend;

proc sql;
select count(*) as N from e.nameoffile;
Quit;

/* record count check*/
proc sql;
create table e_cnts as
select
count (*) as Num_Records
from nameoffile
;
quit;

proc export
data=e_cnts
dbms=xlsx
outfile="C:\location_of_output"
replace;
run;

log:
ERROR: libref e is not assigned
ERROR: File WORK.nameoffile.DATA does not exist.
ERROR: File Work.e_cnts.DATA does not exist&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Sep 2021 20:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770046#M244236</guid>
      <dc:creator>leeleelee</dc:creator>
      <dc:date>2021-09-23T20:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770051#M244238</link>
      <description>&lt;P&gt;Have you tried running any of this code outside of a macro first? Did you get the folder path right? I'm just trying to think of reasons why the library isn't getting assigned.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 21:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770051#M244238</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-09-23T21:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770054#M244239</link>
      <description>&lt;P&gt;Hi, the folder path is right, and I'm new to sas so not sure what running the code outside of the macro means.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 21:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770054#M244239</guid>
      <dc:creator>leeleelee</dc:creator>
      <dc:date>2021-09-23T21:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770055#M244240</link>
      <description>&lt;P&gt;Normally, when people begin writing a macro, they first get the code working outside a macro before macrotizing it. I mean to try running the libname statement by itself and not between %macro and %mend.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 21:28:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770055#M244240</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-09-23T21:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770106#M244263</link>
      <description>&lt;P&gt;The terms "new to sas" while having %macro-statement in the code is something that does not fit. Start learning SAS by not using macro-variables and macros at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The message "libref not assigned" has always one of two reasons:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The path does not exist.&lt;/LI&gt;
&lt;LI&gt;The path exists, but is not accessible by your sas-process.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;If you want to use a path on your computer, sas needs to be running on the very same machine.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 05:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770106#M244263</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-09-24T05:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770121#M244274</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/399920"&gt;@leeleelee&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;... and I'm new to sas ...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then you positively should NOT try your hand at macro coding now. Spend lots of time first getting acquainted with the basic elements of SAS coding (data step and the most often applied procedures, including REPORT and SQL) before you try to make code dynamic through macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personal experience: I had &lt;EM&gt;three weeks&lt;/EM&gt; of programming courses in Heidelberg before I attended the macro course.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 06:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770121#M244274</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-24T06:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Libref not assigned</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770122#M244275</link>
      <description>&lt;P&gt;You define a macro, but you never call it.&lt;/P&gt;
&lt;P&gt;And you define a macro parameter (year) which you never use in the macro.&lt;/P&gt;
&lt;P&gt;Remove the %MACRO and %MEND statements, and rerun your code. (this means "outside of a macro")&lt;/P&gt;
&lt;P&gt;Then copy/paste the&amp;nbsp;&lt;EM&gt;whole&lt;/EM&gt; log into a &amp;lt;/&amp;gt; window.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 06:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Libref-not-assigned/m-p/770122#M244275</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-24T06:24:58Z</dc:date>
    </item>
  </channel>
</rss>

