Hi. I have 4 explanatory variables and 3 of them are categorical, only one of them are numerical variable. I know if i want to use PROC REG or PROC SGSCATTER function, i need to change my numerical variables into categorical. This is my code: data forreg;
set new;
if Stage1 = A Then StageA=1 ; Else StageA=0;
if Stage1 = B Then StageB=1 ; Else StageB=0;
if Stage1 = C Then StageC=1; Else StageC=0;
run; i tried only for Stage1 as an example. But sadly, my code is not working 😕 Here's explanation about my variables: My response variable is 'Exam' (out of 100) and 'Assign' : the student’s Assignment mark (out of 20) 'Stage1': the student’s grade at Stage 1 Statistics: A, B or C 'Grade': What grade the student obtained: A, B, C or D 'Pass':Did the student pass the course or not: No or Yes And here's my error: data forreg; 37 set new; 38 if Stage1 = A Then StageA=1 ; Else StageA=0; 39 if Stage1 = B Then StageB=1 ; Else StageB=0; 40 if Stage1 = C Then StageC=1; Else StageC=0; 41 run; NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column). 39:6 40:6 NOTE: Variable A is uninitialized. NOTE: Invalid numeric data, STAGE1='C' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='C' , at line 40 column 6. GRADE=D PASS=No EXAM=35 DEGREE=Other GENDER=Male ATTEND=No ASSIGN=8 TEST=8.2 B=4 C=1 MC=15 COLOUR=Blue STAGE1=C YEARSSIN=3 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=1 NOTE: Invalid numeric data, STAGE1='C' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='C' , at line 40 column 6. GRADE=D PASS=No EXAM=25 DEGREE=BA GENDER=Male ATTEND=No ASSIGN=8.8 TEST=10.9 B=3 C=0 MC=11 COLOUR=Yellow STAGE1=C YEARSSIN=1.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=2 NOTE: Invalid numeric data, STAGE1='B' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='B' , at line 40 column 6. GRADE=C PASS=Yes EXAM=52 DEGREE=Other GENDER=Female ATTEND=No ASSIGN=12 TEST=15.5 B=8 C=14 MC=15 COLOUR=Yellow STAGE1=B YEARSSIN=0 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=3 NOTE: Invalid numeric data, STAGE1='A' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='A' , at line 40 column 6. GRADE=A PASS=Yes EXAM=81 DEGREE=BCom GENDER=Male ATTEND=No ASSIGN=16.8 TEST=17.3 B=13 C=16 MC=26 COLOUR=Yellow STAGE1=A YEARSSIN=2.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=4 NOTE: Invalid numeric data, STAGE1='A' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='A' , at line 40 column 6. GRADE=A PASS=Yes EXAM=77 DEGREE=BSc GENDER=Female ATTEND=No ASSIGN=16.4 TEST=12.7 B=15 C=18 MC=22 COLOUR=Green STAGE1=A YEARSSIN=0.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=5 NOTE: Invalid numeric data, STAGE1='C' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='C' , at line 40 column 6. GRADE=D PASS=No EXAM=32 DEGREE=BSc GENDER=Female ATTEND=No ASSIGN=8 TEST=10 B=8 C=4 MC=10 COLOUR=Blue STAGE1=C YEARSSIN=1 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=6 NOTE: Invalid numeric data, STAGE1='C' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='C' , at line 40 column 6. GRADE=C PASS=Yes EXAM=46 DEGREE=BSc GENDER=Female ATTEND=No ASSIGN=10.8 TEST=12.7 B=14 C=10 MC=11 COLOUR=Blue STAGE1=C YEARSSIN=0.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=7 NOTE: Invalid numeric data, STAGE1='A' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='A' , at line 40 column 6. GRADE=A PASS=Yes EXAM=89 DEGREE=BSc GENDER=Female ATTEND=No ASSIGN=20 TEST=18.2 B=16 C=15 MC=29 COLOUR=Yellow STAGE1=A YEARSSIN=1 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=8 NOTE: Invalid numeric data, STAGE1='C' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='C' , at line 40 column 6. GRADE=D PASS=No EXAM=36 DEGREE=BSc GENDER=Female ATTEND=No ASSIGN=12.8 TEST=12.7 B=5 C=7 MC=12 COLOUR=Blue STAGE1=C YEARSSIN=2 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=9 NOTE: Invalid numeric data, STAGE1='B' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='B' , at line 40 column 6. GRADE=B PASS=Yes EXAM=57 DEGREE=BCom GENDER=Female ATTEND=No ASSIGN=17.6 TEST=14.5 B=10 C=13 MC=17 COLOUR=Green STAGE1=B YEARSSIN=2 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=10 NOTE: Invalid numeric data, STAGE1='C' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='C' , at line 40 column 6. GRADE=D PASS=No EXAM=35 DEGREE=BSc GENDER=Male ATTEND=No ASSIGN=14 TEST=4.5 B=3 C=10 MC=11 COLOUR=Green STAGE1=C YEARSSIN=1 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=11 NOTE: Invalid numeric data, STAGE1='B' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='B' , at line 40 column 6. GRADE=C PASS=Yes EXAM=44 DEGREE=BSc GENDER=Female ATTEND=No ASSIGN=14.8 TEST=9.1 B=8 C=10 MC=13 COLOUR=Green STAGE1=B YEARSSIN=1.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=12 NOTE: Invalid numeric data, STAGE1='B' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='B' , at line 40 column 6. GRADE=C PASS=Yes EXAM=52 DEGREE=BSc GENDER=Female ATTEND=No ASSIGN=14.4 TEST=6.4 B=7 C=15 MC=15 COLOUR=Pink STAGE1=B YEARSSIN=1.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=13 NOTE: Invalid numeric data, STAGE1='C' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='C' , at line 40 column 6. GRADE=D PASS=No EXAM=32 DEGREE=BA GENDER=Female ATTEND=No ASSIGN=9.6 TEST=13.6 B=4 C=12 MC=8 COLOUR=Green STAGE1=C YEARSSIN=2.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=14 NOTE: Invalid numeric data, STAGE1='C' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='C' , at line 40 column 6. GRADE=C PASS=Yes EXAM=42 DEGREE=BSc GENDER=Male ATTEND=No ASSIGN=11.2 TEST=13.6 B=4 C=10 MC=14 COLOUR=Pink STAGE1=C YEARSSIN=0.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=15 NOTE: Invalid numeric data, STAGE1='B' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='B' , at line 40 column 6. GRADE=C PASS=Yes EXAM=54 DEGREE=BSc GENDER=Female ATTEND=No ASSIGN=14.8 TEST=10.9 B=9 C=13 MC=16 COLOUR=Blue STAGE1=B YEARSSIN=3 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=16 NOTE: Invalid numeric data, STAGE1='A' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='A' , at line 40 column 6. GRADE=A PASS=Yes EXAM=72 DEGREE=BCom GENDER=Male ATTEND=No ASSIGN=17.2 TEST=15.5 B=11 C=17 MC=22 COLOUR=Yellow STAGE1=A YEARSSIN=2 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=17 NOTE: Invalid numeric data, STAGE1='A' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='A' , at line 40 column 6. GRADE=A PASS=Yes EXAM=72 DEGREE=Other GENDER=Male ATTEND=No ASSIGN=16.4 TEST=16.4 B=15 C=9 MC=24 COLOUR=Yellow STAGE1=A YEARSSIN=1 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=18 NOTE: Invalid numeric data, STAGE1='C' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='C' , at line 40 column 6. GRADE=D PASS=No EXAM=41 DEGREE=BSc GENDER=Male ATTEND=No ASSIGN=5.2 TEST=4.5 B=9 C=4 MC=14 COLOUR=Green STAGE1=C YEARSSIN=4.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=19 NOTE: Invalid numeric data, STAGE1='A' , at line 39 column 6. NOTE: Invalid numeric data, STAGE1='A' , at line 40 column 6. WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed. GRADE=D PASS=No EXAM=24 DEGREE=BSc GENDER=Male ATTEND=No ASSIGN=2.8 TEST=14.5 B=0 C=0 MC=12 COLOUR=Yellow STAGE1=A YEARSSIN=1.5 REPEAT=No A= StageA=0 StageB=0 StageC=0 _ERROR_=1 _N_=20 NOTE: There were 146 observations read from the data set WORK.NEW. NOTE: The data set WORK.FORREG has 146 observations and 19 variables. NOTE: DATA statement used (Total process time): real time 0.20 seconds cpu time 0.18 seconds Would you help me kindly please? I also attached the original file of image.
... View more