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

While working with proc fcmp procedure how to assign library with "outlib=" options. Is there a standard way.

 

Getting error with below codes

 

proc fcmp outlib;
function lb2kg(lb);
kg = lb/2.2;
return (kg);
endsub;
run;

 

 

Why do we need the option cmplib. What does the below code says 

 

"options cmplib=(funcsol.functions);"

 

Need help.

1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20

It's a bit confusing that the options is called "outlib", when you are referring to data set observations in a logical structure called package.

So you won't see the three level name somewhere in the SAS library, or by using proc datasets/contents.

But if you open the data set (two level name) you will see the package (several observations).

Data never sleeps

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

OUTLIB= specifies a location where compiled finctions/subroutines will be stored

Syntax is

outlib=mylib.function

where mylib denotes a library that is currently assigned and function is the name of a member of type cmpsub in that library.

 

The system option CMPLIB= lets you specify such a member from which functions/subroutines shall be included.

 

See

PROC FCMP Statement

and

CMPLIB= System Option

 

KafeelBasha
Quartz | Level 8

I came across we have to specify the three level name of a library entry using the formats libref.catalog.paackage. This option
is mandatory when you use the OUTLIB= option

 

But I can able to see only two levels, can you please help me more on this.

 

Kafeel

LinusH
Tourmaline | Level 20

It's a bit confusing that the options is called "outlib", when you are referring to data set observations in a logical structure called package.

So you won't see the three level name somewhere in the SAS library, or by using proc datasets/contents.

But if you open the data set (two level name) you will see the package (several observations).

Data never sleeps
yanamadala85
Obsidian | Level 7

While creating the user defined functions by using PROC FCMP, we have to mention the location where the created function should be saved. It shoud be in the form of three level. First level indicates library name, second level indicated dataset name and third level indicated package name.

 

Within the library, each function or subroutines is associated with a "Package".

Package is a group of functions and subroutines.

Function library can contain multiple packages.

 

Example1;

/* Declaring the function */

proc fcmp outlib=sasuser.study.demo;

   function study_day(intervention_date, event_date);

       n=event_date-intervention_date;

       if n <= 0 then

       n=n+1;

       return (n);

   endsub;

Run;

options cmplib=sasuser.funcs;

data Ae;

   start = '15Feb2006'd;

   today = '27Mar2006'd;

   sd = study_day(start, today);

run

 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 2494 views
  • 5 likes
  • 4 in conversation