I have a population of policy holders that I am trying to edit for a modeling exercise. I have the main population with typical data like contract number, issue date, fund value, etc. I also have to additional tables that get appended to the main population--initial rates and plan info. The initial rates is just a two column document that has contract numbers and their initially assigned interest rates. Plan info is a smaller table that has term period, guaranteed rate, and ultimate rate by plan code. For some reason, my code seems to be failing during a hash statement that should append the plan info guaranteed rate by plan code to the main population. I have never received an error in the past, and I am not sure where to even look based on the error in the log which reads:
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
2793:5
NOTE: Variable CurrCredRate is uninitialized.
NOTE: Variable GuarCredRate is uninitialized.
NOTE: Variable Plan_Code is uninitialized.
NOTE: Variable Ultim_Guar_Code is uninitialized.
NOTE: Variable iCurrinit is uninitialized.
NOTE: Variable Term_Period is uninitialized.
NOTE: There were 9303 observations read from the data set QUARTER.CPFA_IFE.
ERROR: Uninitialized object at line 2807 column 18.
ERROR: DATA STEP Component Object failure. Aborted during the EXECUTION phase.
I look in the main population (the CPFA_IFE) mentioned in the log, but that doesn't even have 18 columns. So, I am assuming it is referencing some table that the hash is creating, but I cannot solve my issue. The section of code that this concerns is below. Any help on what the error means, where to look in my dataset based on what the error is saying, or code corrections is much appreciated!
Data Vantage_HashOutput;
Length CurrCredRate GuarCredRate 8. ;
Set Quarter.CPFA(drop=MVA);
If _n_ = 1 then
do;
declare hash CPFAHash (Dataset:'Quarter.CPFA_IFE');
CPFAHash.defineKey('Contractno');
CPFAHash.defineData('CurrCredRate', 'GuarCredRate');
CPFAHash.defineDone();
End;
DummyVariable = CPFAHash.find();
if CurrCredRate not in("");
Length Plan_Code $4. Ultim_Guar_Code $10. iCurrinit 8. Term_Period $1.;
If _n_ = 1 then
do;
declare hash Vantage_InfoHash (Dataset:'PlanInfo.FW_Vantage_Plan_Info');
Vantage_InfoHash.defineKey('Planid','GuarCredRate');
Vantage_InfoHash.defineData('Plan_Code','Ultim_Guar_Code','Term_Period');
Vantage_InfoHash.defineDone();
declare hash Vantage_InitRateHash (Dataset: 'InitRate.Initial_Rates_FW');
Vantage_InitRateHash.defineKey('Contractno');
Vantage_InitRateHash.defineData('iCurrinit');
Vantage_InitRateHash.defineDone();
End;
DummyVariable = Vantage_InfoHash.find();
DummyVariable = Vantage_InitRateHash.find();
Why didn't you copy the lines of the SAS log that would show which line in your source code were line number 2793 and 2807.
Why do you have two IF _N_=1 blocks?
The problem is the second one is AFTER the subsetting IF statement (the one that is throwing the warning about automatic character to numeric conversions). Since that IF is false for the first observation the second block that creates the other two hash objects never runs.
You need to post the complete log of the step, so we can see what "line number 2807" points to.
My bad. Here is the entire log for the code chunk.
Data Vantage_HashOutput;
2781 Length CurrCredRate GuarCredRate 8. ;
2782 Set Quarter.CPFA(drop=MVA);
2783 If _n_ = 1 then
2784 do;
2785 declare hash CPFAHash (Dataset:'Quarter.CPFA_IFE');
2786 CPFAHash.defineKey('Contractno');
2787 CPFAHash.defineData('CurrCredRate', 'GuarCredRate');
2788 CPFAHash.defineDone();
2789
2790 End;
2791 DummyVariable = CPFAHash.find();
2792
2793 if CurrCredRate not in("");
2794
2795 Length Plan_Code $4. Ultim_Guar_Code $10. iCurrinit 8. Term_Period $1.;
2796 If _n_ = 1 then
2797 do;
2798 declare hash Vantage_InfoHash (Dataset:'PlanInfo.FW_Vantage_Plan_Info');
2799 Vantage_InfoHash.defineKey('Planid','GuarCredRate');
2800 Vantage_InfoHash.defineData('Plan_Code','Ultim_Guar_Code','Term_Period');
2801 Vantage_InfoHash.defineDone();
2802 declare hash Vantage_InitRateHash (Dataset: 'InitRate.Initial_Rates_FW');
2803 Vantage_InitRateHash.defineKey('Contractno');
60 The SAS System 09:21 Monday, May 11, 2020
2804 Vantage_InitRateHash.defineData('iCurrinit');
2805 Vantage_InitRateHash.defineDone();
2806 End;
2807 DummyVariable = Vantage_InfoHash.find();
2808 DummyVariable = Vantage_InitRateHash.find();
2809
2810 if Plan_code not in("");
2811
2812 if X<40 then
2813 Iss_Age="035";
2814 else if X>39 and X<50 then
2815 Iss_Age="045";
2816 else if X>49 and X<60 then
2817 Iss_Age="055";
2818 else if X>59 and X<70 then
2819 Iss_Age="065";
2820 else if X>69 and X<80 then
2821 Iss_Age="075";
2822 else Iss_Age="085";
2823
2824 if SEXX=1 then Gender='M';
2825 else Gender='F';
2826
2827 Smoker='A';
2828 Company=6.;
2829 MVA='Y';
2830 Part_Rate='N';
2831 Cap_Rate='N';
2832 char7='_';
2833 /*char8*/
2834 ATHCheck = substrn(Version,max(1,length(Version)-2),3);
2835 ATHCheck2 = substrn(Version,max(1,length(Version)-3),4);
2836 CWCheck = substrn(Version,max(1,length(Version)-1),2);
2837 if ATHCheck = "ATH" then
2838 do;
2839 char8 = '2';
2840 end;
2841 else if ATHCheck2 = "ATH2" then
2842 do;
2843 char8 = '3';
2844 end;
2845 else if CWCheck = "CW" then
2846 do;
2847 char8 = '4';
2848 end;
2849 else char8 = '_';
2850
2851 Iss_yr = year(idate);
2852 qtr1=month(idate);
2853 YTD_Prem_1st=0;
2854 YTD_Prem_Ren=0;
2855 YTD_PW=0;
2856 PARTRATE=0;
2857 ME_chrg=0;
2858 EIA_Cap=0;
2859 Sep_acct=0;
2860 Bonus_Int=0;
2861 Dth_Ben_Rcht_Amt = 0;
61 The SAS System 09:21 Monday, May 11, 2020
2862 Dth_Ben_Reset_Amt = 0;
2863 Dth_Ben_Rollup_Amt = 0;
2864 Sep_Acct=0;
2865 Total_MVA=0;
2866
2867
2868 run;
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
2793:5
NOTE: Variable CurrCredRate is uninitialized.
NOTE: Variable GuarCredRate is uninitialized.
NOTE: Variable Plan_Code is uninitialized.
NOTE: Variable Ultim_Guar_Code is uninitialized.
NOTE: Variable iCurrinit is uninitialized.
NOTE: Variable Term_Period is uninitialized.
NOTE: There were 9303 observations read from the data set QUARTER.CPFA_IFE.
ERROR: Uninitialized object at line 2807 column 18.
ERROR: DATA STEP Component Object failure. Aborted during the EXECUTION phase.
What @Tom said, use only one if _n_ = 1 block, to avoid a mistake like yours, putting the second block after the subsetting if.
Why didn't you copy the lines of the SAS log that would show which line in your source code were line number 2793 and 2807.
Why do you have two IF _N_=1 blocks?
The problem is the second one is AFTER the subsetting IF statement (the one that is throwing the warning about automatic character to numeric conversions). Since that IF is false for the first observation the second block that creates the other two hash objects never runs.
Yah, I cut it off. Here is the whole log for the code chunk.
Data Vantage_HashOutput;
2781 Length CurrCredRate GuarCredRate 8. ;
2782 Set Quarter.CPFA(drop=MVA);
2783 If _n_ = 1 then
2784 do;
2785 declare hash CPFAHash (Dataset:'Quarter.CPFA_IFE');
2786 CPFAHash.defineKey('Contractno');
2787 CPFAHash.defineData('CurrCredRate', 'GuarCredRate');
2788 CPFAHash.defineDone();
2789
2790 End;
2791 DummyVariable = CPFAHash.find();
2792
2793 if CurrCredRate not in("");
2794
2795 Length Plan_Code $4. Ultim_Guar_Code $10. iCurrinit 8. Term_Period $1.;
2796 If _n_ = 1 then
2797 do;
2798 declare hash Vantage_InfoHash (Dataset:'PlanInfo.FW_Vantage_Plan_Info');
2799 Vantage_InfoHash.defineKey('Planid','GuarCredRate');
2800 Vantage_InfoHash.defineData('Plan_Code','Ultim_Guar_Code','Term_Period');
2801 Vantage_InfoHash.defineDone();
2802 declare hash Vantage_InitRateHash (Dataset: 'InitRate.Initial_Rates_FW');
2803 Vantage_InitRateHash.defineKey('Contractno');
60 The SAS System 09:21 Monday, May 11, 2020
2804 Vantage_InitRateHash.defineData('iCurrinit');
2805 Vantage_InitRateHash.defineDone();
2806 End;
2807 DummyVariable = Vantage_InfoHash.find();
2808 DummyVariable = Vantage_InitRateHash.find();
2809
2810 if Plan_code not in("");
2811
2812 if X<40 then
2813 Iss_Age="035";
2814 else if X>39 and X<50 then
2815 Iss_Age="045";
2816 else if X>49 and X<60 then
2817 Iss_Age="055";
2818 else if X>59 and X<70 then
2819 Iss_Age="065";
2820 else if X>69 and X<80 then
2821 Iss_Age="075";
2822 else Iss_Age="085";
2823
2824 if SEXX=1 then Gender='M';
2825 else Gender='F';
2826
2827 Smoker='A';
2828 Company=6.;
2829 MVA='Y';
2830 Part_Rate='N';
2831 Cap_Rate='N';
2832 char7='_';
2833 /*char8*/
2834 ATHCheck = substrn(Version,max(1,length(Version)-2),3);
2835 ATHCheck2 = substrn(Version,max(1,length(Version)-3),4);
2836 CWCheck = substrn(Version,max(1,length(Version)-1),2);
2837 if ATHCheck = "ATH" then
2838 do;
2839 char8 = '2';
2840 end;
2841 else if ATHCheck2 = "ATH2" then
2842 do;
2843 char8 = '3';
2844 end;
2845 else if CWCheck = "CW" then
2846 do;
2847 char8 = '4';
2848 end;
2849 else char8 = '_';
2850
2851 Iss_yr = year(idate);
2852 qtr1=month(idate);
2853 YTD_Prem_1st=0;
2854 YTD_Prem_Ren=0;
2855 YTD_PW=0;
2856 PARTRATE=0;
2857 ME_chrg=0;
2858 EIA_Cap=0;
2859 Sep_acct=0;
2860 Bonus_Int=0;
2861 Dth_Ben_Rcht_Amt = 0;
61 The SAS System 09:21 Monday, May 11, 2020
2862 Dth_Ben_Reset_Amt = 0;
2863 Dth_Ben_Rollup_Amt = 0;
2864 Sep_Acct=0;
2865 Total_MVA=0;
2866
2867
2868 run;
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
2793:5
NOTE: Variable CurrCredRate is uninitialized.
NOTE: Variable GuarCredRate is uninitialized.
NOTE: Variable Plan_Code is uninitialized.
NOTE: Variable Ultim_Guar_Code is uninitialized.
NOTE: Variable iCurrinit is uninitialized.
NOTE: Variable Term_Period is uninitialized.
NOTE: There were 9303 observations read from the data set QUARTER.CPFA_IFE.
ERROR: Uninitialized object at line 2807 column 18.
ERROR: DATA STEP Component Object failure. Aborted during the EXECUTION phase.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.