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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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