Hello folks
I have the thankless task to rewrite undocumented SAS code. At one point a DATA step references CMPLIB=. Fortunately the referenced file is still available, unfortunately not the SAS program that generates the functions it contains. However, this SAS file contains "data lines" that contain commands and some kind of BEGIN / END logic. Do you know a way to "translate" the contained functions back into DATA step code?
Please share if you ever had such a job.
Kind regards
Hon
I assume some user defined functions have been created using Proc FCMP.
To list all functions and subroutines, you can use the following code, where work.myfunc is the name you used in the CMPLIB option:
/*
* get a listing of all function
*/
proc fcmp inlib=work.myfunc listfuncs;
run;
You then get a list of functions/subroutines.
To see the code for an individual function use this code:
/*
* list code for an individual function
*/
proc fcmp inlib=work.myfunc;
listfunc kt_convert;
run;
Whenever you see a line like _yourFunctionName_ = ...;, this is the RETURN statement in the function definition.
Similar to the LISTFUNC statement there is the LISTSUBR statement to list the code for a subroutine.
I assume some user defined functions have been created using Proc FCMP.
To list all functions and subroutines, you can use the following code, where work.myfunc is the name you used in the CMPLIB option:
/*
* get a listing of all function
*/
proc fcmp inlib=work.myfunc listfuncs;
run;
You then get a list of functions/subroutines.
To see the code for an individual function use this code:
/*
* list code for an individual function
*/
proc fcmp inlib=work.myfunc;
listfunc kt_convert;
run;
Whenever you see a line like _yourFunctionName_ = ...;, this is the RETURN statement in the function definition.
Similar to the LISTFUNC statement there is the LISTSUBR statement to list the code for a subroutine.
Bruno, That's one big step forward! I was a bit lost what to do next. Thanks a lot! HB
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.
Ready to level-up your skills? Choose your own adventure.