Help using Base SAS procedures

Libname with numbers and a SQL procedure in BASE SAS

Reply
Occasional Contributor
Posts: 8

Libname with numbers and a SQL procedure in BASE SAS

Hi

I believed that Library names had to follow the SAS norms to be valid; i.e. they should begin with either a character or an underscore ( _ ) and after that other characters or NUMBERS are allowed.

However when I assing the following library:

LIBNAME MEGA712 BASE "W:\Stat\....\Testdata_subset";

1). there is no error message in the log...so it should be OK.

2). Then, I run the following sqL CREATE VIEW with 2 tables located in the mentioned library:


PROC SQL;
CREATE VIEW work.minimega AS
SELECT a.*, b.*
FROM MEGA712.Megadataset a, MEGA172.Megadataset2 b
WHERE a.PID=b.PID
AND a.Visit = b.Visit;
QUIT;

3). and again, there is no error message in the log...

4). but when I try to open the created VIEW, a get the following error message:

ERROR: Libname MEGA172 is not assigned.
ERROR: SQL View WORK.MINIMEGA could not be processed because at least one of the data sets, or
views, referenced directly (or indirectly) by it could not be located, or opened successfully.



after many attemps, someone suggest me to change the name of the library with just characters, like this:

LIBNAME MEGA BASE "W:\Stat\....\Testdata_subset";

and success! with the change of name from MEGA712 to MEGA I don't get anymore problems with the SQL view.

Later I test other non-SQL SAS procedures with the MEGA712 library and I don't have problems at all. Then, why I get such error message with the name MEGA172 but not with MEGA? any suggestions about this?


Kind regards
Karolus Message was edited by: Karolus
Frequent Contributor
Frequent Contributor
Posts: 76

Re: Libname with numbers and a SQL procedure in BASE SAS

You show a libname definition for MEGA712, but not MEGA172. Has the libname MEGA172 also been defined? or are both of the dataset in the MEGA712 library?

> Hi
>
> I believed that Library names had to follow the SAS
> norms to be valid; i.e. they should begin with either
> a character or an underscore ( _ ) and after that
> other characters or NUMBERS are allowed.
>
> However when I assing the following library:
>
> LIBNAME MEGA712 BASE "W:\Stat\....\Testdata_subset";
>
> 1). there is no error message in the log...so it
> should be OK.
>
> 2). Then, I run the following sqL CREATE VIEW with 2
> tables located in the mentioned library:
>
>
> PROC SQL;
> CREATE VIEW work.minimega AS
> SELECT a.*, b.*
> FROM MEGA712.Megadataset a, MEGA172.Megadataset2 b
> WHERE a.PID=b.PID
> AND a.Visit = b.Visit;
> QUIT;
>
> 3). and again, there is no error message in the
> log...
>
> 4). but when I try to open the created VIEW, a get
> the following error message:
>
> ERROR: Libname MEGA172 is not assigned.
> ERROR: SQL View WORK.MINIMEGA could not be processed
> because at least one of the data sets, or
> views, referenced directly (or indirectly) by it
> could not be located, or opened successfully.

>
>
> after many attemps, someone suggest me to change the
> name of the library with just characters, like this:
>
> LIBNAME MEGA BASE "W:\Stat\....\Testdata_subset";
>
> and success! with the change of name from MEGA712 to
> MEGA I don't get anymore problems with the SQL view.
>
> Later I test other non-SQL SAS procedures with the
> MEGA712 library and I don't have problems at all.
> Then, why I get such error message with the name
> MEGA172 but not with MEGA? any suggestions about
> this?
>
>
> Kind regards
> Karolus
>
> Message was edited by: Karolus
Occasional Contributor
Posts: 8

Re: Libname with numbers and a SQL procedure in BASE SAS

Hi LAP

You're damn right, it was just a typo. You definitly have a good eye!! I can't believe I still make such a newbie mistake. Sorry for have you wasted your time.


Regards
Karolus
Ask a Question
Discussion stats
  • 2 replies
  • 518 views
  • 0 likes
  • 2 in conversation