I have a "libref is not assigned" error that I can't figure out. I have tried looking at other questions but so far I haven't seen anything like this. It all comes down to me trying to join two tables using proc sql. This step fails and I receive the libref not assigned error. I was confused so I explicitly assigned the library reference in my code, and selected the top 10 records from each table that I want to use in the join to make sure that the library reference was working and it does. But then when I try to do the join it fails. The libref not assigned error doesn't make sense to me.
Here is my code:
libname NBBO2 '/the/file/path';
proc sql inobs = 10; select * from NBBO2.SAMPLE_FILINGS_2005; QUIT;
proc sql inobs = 10; select * from NBBO2.SORTED_NBBO2005; QUIT;
/*STEP AA1 - ADD THE PRICE AT FILING TIME TO EACH FILING RECORD*/
PROC SQL;
CREATE TABLE STEP_AA1 AS
SELECT
A.*
,(B.BB + B.BO)/2 AS Price_at_filing
FROM NBBO2.SAMPLE_FILINGS_2005 AS A
JOIN NBB02.SORTED_NBBO2005 AS B
ON A.TICKER = B.SYMBOL
AND A.file_date = B.DATE
AND B.TIME <= A.file_time < B.TIME_end
;
QUIT;
And here is the log containing the error:
NOTE: SAS initialization used: real time 11.08 seconds cpu time 0.32 seconds 1 libname NBBO2 '/the/file/path'; NOTE: Libref NBBO2 was successfully assigned as follows: Engine: V9 Physical Name: /the/file/path; 2 proc sql inobs = 10; 2 ! select * from NBBO2.SAMPLE_FILINGS_2005; NOTE: Data file NBBO2.SAMPLE_FILINGS_2005.DATA is in a format that is native to another host, or the file encoding does not match the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce performance. WARNING: Only 10 records were read from NBBO2.SAMPLE_FILINGS_2005 due to INOBS= option. 2 ! QUIT; NOTE: PROCEDURE SQL used (Total process time): real time 0.29 seconds cpu time 0.05 seconds 3 proc sql inobs = 10; 3 ! select * from NBBO2.SORTED_NBBO2005; WARNING: Only 10 records were read from NBBO2.SORTED_NBBO2005 due to INOBS= option. 3 ! QUIT; NOTE: PROCEDURE SQL used (Total process time): real time 0.13 seconds cpu time 0.00 seconds 4 5 /*STEP AA1 - ADD THE PRICE AT FILING TIME TO EACH FILING RECORD*/ 6 PROC SQL; 7 CREATE TABLE STEP_AA1 AS 8 SELECT 9 A.* 10 ,(B.BB + B.BO)/2 AS Price_at_filing 11 FROM NBBO2.SAMPLE_FILINGS_2005 AS A 12 JOIN NBB02.SORTED_NBBO2005 AS B 13 ON A.TICKER = B.SYMBOL 14 AND A.file_date = B.DATE 15 AND B.TIME <= A.file_time < B.TIME_end 16 ; NOTE: Data file NBBO2.SAMPLE_FILINGS_2005.DATA is in a format that is native to another host, or the file encoding does not match the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce performance. ERROR: Libref NBB02 is not assigned. 17 QUIT; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SQL used (Total process time): real time 0.29 seconds cpu time 0.01 seconds
I can't figure it out. Is it really a problem with the table formats?
Thanks in advance for any help!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.