BookmarkSubscribeRSS Feed
samlac
Fluorite | Level 6

Hello,

 

I'm having an issue with this code:

%IF &SAVE_OUTPUT. = Y %THEN %DO;
        PROC SQL _METHOD UNDO_POLICY=NONE;
CREATE VIEW &TABLES_SAVE_PATH_LIBNAME..PnC_Quote_Central AS
            SELECT   MAT.*,
                        MAIN.*
                FROM &TABLES_SAVE_PATH_LIBNAME..SUBMISSION_MATURITY_TABLE (WHERE=(MATURITY_GROUP='Ultimate')) MAT
                LEFT JOIN &TABLES_SAVE_PATH_LIBNAME..SUBMISSION_MAIN_TABLE MAIN
                    ON MAT.AGREEMENT_NUMBER=MAIN.AGREEMENT_NUMBER
USING LIBNAME &TABLES_SAVE_PATH_LIBNAME. "&TABLES_SAVE_PATH.";
        QUIT;
%END;
Although its working great, if I move the folder that contain the 2 referenced tables and my view to some other location. The view will not be working as the libname was a static path.
 
How can I make the reference to my two tables relative to the path of the location of the view I want to create? So that I can move my folder anywhere without breaking the View.
 
Best regards,
Samuel

 

3 REPLIES 3
Kurt_Bremser
Super User
You need to redefine the library to the new physical path. In SQL, there is no „relative“ path to a table. A single-level name will always point to WORK or USER.
samlac
Fluorite | Level 6
Thank you for the quick reply. By curiosity, would there be a way to do it with a Dataset? By your answer, I understand that the limitation comes from SQL.
Kurt_Bremser
Super User

@samlac wrote:
Thank you for the quick reply. By curiosity, would there be a way to do it with a Dataset? By your answer, I understand that the limitation comes from SQL.

No. The physical location of a dataset is determined through the library assignment, no matter where in SAS you use them.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 271 views
  • 0 likes
  • 2 in conversation