<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using Proc FCMP with VVALUEX Function in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-FCMP-with-VVALUEX-Function/m-p/462766#M70414</link>
    <description>&lt;P&gt;Hey! I'm new to using Proc FCMP. This is my first attempt. Just experimenting with replacing some repetitive code that's a string of functions with a Proc FCMP function. However, I've run into a little trouble with the VVALUEX function that's in the string I'm trying to replace. Looking for a little help!&amp;nbsp;Using Base SAS 9.4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example of the code I'm trying to replace. I realize this may not make sense - just playing around with Proc FCMP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;LALAE_Lmtd_Paid_LDF_PLmt_Upper = Input(Left(VValueX(Catt('LALAE_',PLmt_Upper_LDF_Char,'Pd'))),8.);
LO_Lmtd_Incd_LDF_Ded_Lower = Input(Left(VValueX(Catt('LO_',Ded_Lower_LDF_Char,'Inc'))),8.);
XS_Incd_LDF_Ded_Lower = Input(Left(VValueX(Catt('XS_',Ded_Lower_XS_LDF_Char,'Inc'))),8.);
LALAE_Lmtd_Incd_LDF_100K = Input(Left(VValueX('LALAE_LDF_100kInc')),8.);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the Proc FCMP code and error message:&lt;/P&gt;
&lt;PRE&gt;Proc FCMP Outlib = My_Lib.functions.myfncs;
    Function MyFctrLkp(Fctr_To_Lkp $);
        Fctr = Input(Left(VValueX(Fctr_To_Lkp)),8.);
        Return(Fctr);
    EndSub;
Run;
&lt;/PRE&gt;
&lt;P&gt;ERROR: The VVALUEX function is only valid in the DATA step. User defined libraries will be searched for a &lt;BR /&gt; definition of this function.&lt;BR /&gt;NOTE: Numeric value converted to character for argument 1 of 'LEFT' operation.&lt;/P&gt;
&lt;P&gt;ERROR: Cannot find a library containing subroutine VVALUEX.&lt;BR /&gt;NOTE: Execution aborted because of errors in program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's what I'm trying to accomplish:&lt;/P&gt;
&lt;PRE&gt;LALAE_Lmtd_Paid_LDF_PLmt_Upper = MyFctrLkp(Catt('LALAE_',PLmt_Upper_LDF_Char,'Pd'));
LO_Lmtd_Incd_LDF_Ded_Lower = MyFctrLkp(Catt('LO_',Ded_Lower_LDF_Char,'Inc'));
XS_Incd_LDF_Ded_Lower = MyFctrLkp(Catt('XS_',Ded_Lower_XS_LDF_Char,'Inc'));
LALAE_Lmtd_Incd_LDF_100K = MyFctrLkp('LALAE_LDF_100kInc');&lt;/PRE&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 May 2018 16:38:47 GMT</pubDate>
    <dc:creator>rileyd</dc:creator>
    <dc:date>2018-05-16T16:38:47Z</dc:date>
    <item>
      <title>Using Proc FCMP with VVALUEX Function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-FCMP-with-VVALUEX-Function/m-p/462766#M70414</link>
      <description>&lt;P&gt;Hey! I'm new to using Proc FCMP. This is my first attempt. Just experimenting with replacing some repetitive code that's a string of functions with a Proc FCMP function. However, I've run into a little trouble with the VVALUEX function that's in the string I'm trying to replace. Looking for a little help!&amp;nbsp;Using Base SAS 9.4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example of the code I'm trying to replace. I realize this may not make sense - just playing around with Proc FCMP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;LALAE_Lmtd_Paid_LDF_PLmt_Upper = Input(Left(VValueX(Catt('LALAE_',PLmt_Upper_LDF_Char,'Pd'))),8.);
LO_Lmtd_Incd_LDF_Ded_Lower = Input(Left(VValueX(Catt('LO_',Ded_Lower_LDF_Char,'Inc'))),8.);
XS_Incd_LDF_Ded_Lower = Input(Left(VValueX(Catt('XS_',Ded_Lower_XS_LDF_Char,'Inc'))),8.);
LALAE_Lmtd_Incd_LDF_100K = Input(Left(VValueX('LALAE_LDF_100kInc')),8.);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the Proc FCMP code and error message:&lt;/P&gt;
&lt;PRE&gt;Proc FCMP Outlib = My_Lib.functions.myfncs;
    Function MyFctrLkp(Fctr_To_Lkp $);
        Fctr = Input(Left(VValueX(Fctr_To_Lkp)),8.);
        Return(Fctr);
    EndSub;
Run;
&lt;/PRE&gt;
&lt;P&gt;ERROR: The VVALUEX function is only valid in the DATA step. User defined libraries will be searched for a &lt;BR /&gt; definition of this function.&lt;BR /&gt;NOTE: Numeric value converted to character for argument 1 of 'LEFT' operation.&lt;/P&gt;
&lt;P&gt;ERROR: Cannot find a library containing subroutine VVALUEX.&lt;BR /&gt;NOTE: Execution aborted because of errors in program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's what I'm trying to accomplish:&lt;/P&gt;
&lt;PRE&gt;LALAE_Lmtd_Paid_LDF_PLmt_Upper = MyFctrLkp(Catt('LALAE_',PLmt_Upper_LDF_Char,'Pd'));
LO_Lmtd_Incd_LDF_Ded_Lower = MyFctrLkp(Catt('LO_',Ded_Lower_LDF_Char,'Inc'));
XS_Incd_LDF_Ded_Lower = MyFctrLkp(Catt('XS_',Ded_Lower_XS_LDF_Char,'Inc'));
LALAE_Lmtd_Incd_LDF_100K = MyFctrLkp('LALAE_LDF_100kInc');&lt;/PRE&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 16:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-FCMP-with-VVALUEX-Function/m-p/462766#M70414</guid>
      <dc:creator>rileyd</dc:creator>
      <dc:date>2018-05-16T16:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proc FCMP with VVALUEX Function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-FCMP-with-VVALUEX-Function/m-p/462806#M70417</link>
      <description>&lt;P&gt;Variables in the program data vector are not accessible within a function.&amp;nbsp; Consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fCMP Outlib = work.functions.myfncs;
    Function Myfunct();
        Fctr = age;
        Return(Fctr);
    EndSub;
run;
options cmplib=work.functions;
data want;
  set sashelp.class;
  var=Myfunct();
  put var=;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which results in VAR=. for all observations.&amp;nbsp; That's because you have to pass the value of age TO the function in the guise of a function argument (which may or may not also be named age).&amp;nbsp; Of course no message is generated - only missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But VVALUEX is one layer worse, since it is supposed to have variable name as an argument and then go to the pdv to get the value for that variable.&amp;nbsp; The function compiler knows this, so it tells you VVALUEX can't be used within a function definition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 18:58:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-FCMP-with-VVALUEX-Function/m-p/462806#M70417</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-05-16T18:58:50Z</dc:date>
    </item>
  </channel>
</rss>

