BookmarkSubscribeRSS Feed
zalahmed
Calcite | Level 5

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

10 REPLIES 10
Reeza
Super User

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;

zalahmed
Calcite | Level 5

no format applied to nationality 

Reeza
Super User

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

zalahmed
Calcite | Level 5

Attachedproc freq and proc contents  

Reeza
Super User

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. 

ballardw
Super User

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?

 

 

StatDave
SAS Super FREQ

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;

Reeza
Super User

@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. 

zalahmed
Calcite | Level 5

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

Thanks 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 10 replies
  • 3788 views
  • 1 like
  • 5 in conversation