BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
eb175
Fluorite | Level 6

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!

 

1 ACCEPTED SOLUTION

Accepted Solutions
AMSAS
SAS Super FREQ
You have a typo

FROM NBBO2.SAMPLE_FILINGS_2005 AS A << This line is the letter O (NBBO2)
JOIN NBB02.SORTED_NBBO2005 AS B << This line is the number 0 (NBB<zero>2)

View solution in original post

3 REPLIES 3
AMSAS
SAS Super FREQ
You have a typo

FROM NBBO2.SAMPLE_FILINGS_2005 AS A << This line is the letter O (NBBO2)
JOIN NBB02.SORTED_NBBO2005 AS B << This line is the number 0 (NBB<zero>2)

eb175
Fluorite | Level 6
Oh my goodness - I don't know if I ever would have noticed that. Thank you so much! I will hang my head in shame now.
AMSAS
SAS Super FREQ
Hey we've all been there - It's like looking for your glasses only to be told they are on top of your head

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 4116 views
  • 1 like
  • 2 in conversation