Programming the statistical procedures from SAS

Invalid reference value for nationality

Reply
New Contributor
Posts: 4

Invalid reference value for nationality

how to solve this error below? nationality variables value either 1 or 2 in the data set , 

 

SAS code: 

 

 

proc logistic data=work.project1 plots=ODDSRATIO

 outest=betas covout

 class sector (param=ref ref='4') age_cat (param=ref ref='1') speciality_cat(param=ref ref='1') gender(param=ref ref='1')

nationality (param=ref ref='2') education_cat (param=ref ref='1')  university_cat(param=ref ref='1') number_adult_cat(param=ref ref='2')

number_nurses_cat(param=ref ref='1')BMI_cat(param=ref ref='1') physician_hgeneral_cat(param=ref ref='1') physician_chronic(param=ref ref='2'

smoking(param=ref ref='1') sleep_hours_cat(param=ref ref='1') knowledge_all_cat(param=ref ref='1')

aerobic_cat(param=ref ref='1') marital_cat(param=ref ref='1') YWEG_cat(param=ref ref='1')

number_pediatric_cat(param=ref ref='2') number_physicians_cat(param=ref ref='1')taining (param=ref ref='2') referal_system(param=ref ref='2');       

model provide_general_without_cat(Event='2')=sector age_cat speciality_cat gender nationality education_cat university_cat number_adult_cat 

number_nurses_cat BMI_cat physician_hgeneral_cat physician_chronic smoking sleep_hours_cat 

knowledge_all_cat  marital_cat YWEG_cat number_pediatric_cat number_physicians_cat taining 

referal_system  marital_cat YWEG_cat aerobic_cat

/link=logit

selection=stepwise

                    slentry=0.2

                    slstay=0.25

                    details

                    lackfit;

    output out=pred p=phat lower=lcl upper=ucl ;

run;

 

 

SAS log:

 

596

597  proc logistic data=work.project1 plots=ODDSRATIO

598   outest=betas covout ;

599   class sector (param=ref ref='2') age_cat (param=ref ref='1') speciality_cat(param=ref

599! ref='1') gender(param=ref ref='1')

600  nationality (param=ref ref='2') education_cat (param=ref ref='1')  university_cat(param=ref

600! ref='1') number_adult_cat(param=ref ref='2')

601  number_nurses_cat(param=ref ref='1')BMI_cat(param=ref ref='1')

601! physician_hgeneral_cat(param=ref ref='1') physician_chronic(param=ref ref='2')

602  smoking(param=ref ref='1') sleep_hours_cat(param=ref ref='1') knowledge_all_cat(param=ref

602! ref='1')

603  aerobic_cat(param=ref ref='1') marital_cat(param=ref ref='1') YWEG_cat(param=ref ref='1')

604  number_pediatric_cat(param=ref ref='2') number_physicians_cat(param=ref ref='1')taining

604! (param=ref ref='2') referal_system(param=ref ref='2');

605  model provide_general_without_cat(Event='2')=sector age_cat speciality_cat gender nationality

605! education_cat university_cat number_adult_cat

606  number_nurses_cat BMI_cat physician_hgeneral_cat physician_chronic smoking sleep_hours_cat

607  knowledge_all_cat  marital_cat YWEG_cat number_pediatric_cat number_physicians_cat taining

608  referal_system  marital_cat YWEG_cat aerobic_cat

609                      /link=logit

610                      selection=stepwise

611                      slentry=0.2

612                      slstay=0.25

613                      details

614                      lackfit;

615      output out=pred p=phat lower=lcl upper=ucl ;

616  run;

 

ERROR: Invalid reference value for nationality.

NOTE: The SAS System stopped processing this step because of errors.

NOTE: There were 147 observations read from the data set WORK.PROJECT1.

WARNING: The data set WORK.BETAS may be incomplete.  When this step was stopped there were 0

         observations and 0 variables.

WARNING: Data set WORK.BETAS was not replaced because this step was stopped.

WARNING: The data set WORK.PRED may be incomplete.  When this step was stopped there were 0

         observations and 0 variables.

WARNING: Data set WORK.PRED was not replaced because this step was stopped.

NOTE: PROCEDURE LOGISTIC used (Total process time):

      real time           0.01 seconds

      cpu time            0.01 seconds

Super User
Posts: 18,567

Re: Invalid reference value for nationality

Does nationality have a format applied? The ref option requires the formatted values. 

 

FYI you can include PARAM=REF after your class statement if all categorical variables will be using it. This means you can reduce your code. 

 

CLASS ....  / Param=ref;

New Contributor
Posts: 4

Re: Invalid reference value for nationality

no format applied to nationality 

Super User
Posts: 18,567

Re: Invalid reference value for nationality

Then post a proc freq for the variable as well as a proc contents for your data set. 

New Contributor
Posts: 4

Re: Invalid reference value for nationality

Attachedproc freq and proc contents  

Super User
Posts: 18,567

Re: Invalid reference value for nationality

I'm not seeing anything specific. What happens if you reduce the model to only nationality? 

 

You know that you have two many variables for your data? A quick rule of thumb is that you need approximately 30 obs per variable. 

Super User
Posts: 10,868

Re: Invalid reference value for nationality

By any chance to you have a combination of the class variables that does not include nationality='2'? Or is nationality numeric and not character?

 

 

SAS Employee
Posts: 242

Re: Invalid reference value for nationality

If the variable has a user-defined format assigned, you must specify the formatted value in the REF= option.  Also, note that you do not need to specify PARAM=REF for each variable.  You can specify it once, after a slash, at the end of the CLASS statement. For example: 

 

class a(ref="1") b(ref="hi") / param=ref;

Super User
Posts: 18,567

Re: Invalid reference value for nationality

@zalahmed at this point you'll either need to provide your data so we can replicate the issue or contact SAS Tech Support for help. I suspect the issue is for a specific level there is no values of 2, but I would expect a different error.

 

As I previously mentioned, you have too many variables and I don't think it's possible to fit your model. The number of observations must be greater than the number of variables for the matrix math to work out - back to the really basic linear algebra interpretation of regression. 

New Contributor
Posts: 4

Re: Invalid reference value for nationality

I will try to change the model , and let you know what's work 

Thanks 

Ask a Question
Discussion stats
  • 9 replies
  • 268 views
  • 1 like
  • 4 in conversation