BookmarkSubscribeRSS Feed
sasquestion
Calcite | Level 5

I have a programe which run both on EG and as a stored procedure. when I ran in EG in prod or Dev enviroment the libname automatically select the enviroment and ran the code, But when it is run as stored Procedure, it need to be change as manually for each enviroment.

I tried all option but not able to make the libname dynamic for Stored procedrue. Pls help me to suggest how to make dynamic code for libname in stored.

6 REPLIES 6
Kurt_Bremser
Super User

I would not change the library reference in the program.

Instead define the libraries in metadata with the same libref, but different paths. Then assign one definition to the prod stored process server and the other to the dev stored process server.

sasquestion
Calcite | Level 5

Hi KurtBremser,

 

Could you please explain the it more.

 

Thanks

Kurt_Bremser
Super User

Assume you have two directories:

/sasdata/xxxprod

/sasdata/xxxdev

In SAS Management Console (Plug-Ins), open the Data Library Manager

Right-Click Libraries, select New Library

Name it XXX-Prod, on the next tab, assign it to the production server, in Options, give it the libref XXX, and set the path to /sasdata/xxxprod

Once you have finished, repeat the same, but name it XXX-Dev, assign it to the development server, and set the path to /sasdata/xxxdev

 

You now have a libref XXX in both production and development, which points to different paths, depending on the server context.

 

 

sasquestion
Calcite | Level 5

Thank you,

 

Is it possible to have in the programme of stored procedure.

Kurt_Bremser
Super User

The SAS program will not need to do any changes to the library. But you will need separate stored process definitions for the prod and dev server, both pointing to the same physical SAS program file.

LinusH
Tourmaline | Level 20
Agree with @Kurt_Bremser but I would even sugest that the stp SAS file should be separated between your different SAS environments. This will let you develop / change your logic in a controlled environment without disturbing the live report in the production environment.
Data never sleeps

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 6 replies
  • 1353 views
  • 0 likes
  • 3 in conversation