Hi, I am working on a dataset with microorganisms. For Proc format, my values are CMV_IgG_rev 1.'Present', 2.'Absent'. In Proc logistic, I put (ref='Absent') or (ref='2'), log turns out invalid reference value. Please guide me.
Thanks
Maxim 3: Know Your Data.
Run a proc contents on your dataset (to see the type of CMV_IgG_rev) and a proc freq for variable CMV_IgG_rev.
Please post the code, or better, the log of the format and logistic proc calls.
proc logistic data= pe. matched_21_plus_co_inf_updated;
strata group;
class CMV_IgG_rev (ref='2');
model PEstatus (event='1')= CMV_IgG_rev;
run;
316 proc logistic data= pe. matched_21_plus_co_inf_updated;
NOTE: Data file PE.MATCHED_21_PLUS_CO_INF_UPDATED.DATA is in a format that is native to another
host, or the file encoding does not match the session encoding. Cross Environment Data Access
will be used, which might require additional CPU resources and might reduce performance.
317 strata group;
318 class CMV_IgG_rev (ref='2');
319 model PEstatus (event='1')= CMV_IgG_rev;
320 run;
ERROR: Invalid reference value for CMV_IgG_rev.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 78 observations read from the data set PE.MATCHED_21_PLUS_CO_INF_UPDATED.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
If you think the variable is numeric with single digit values then try using a format statement to make sure.
proc logistic data= pe. matched_21_plus_co_inf_updated;
strata group;
class CMV_IgG_rev (ref='2');
format CMV_IgG_rev 1.;
model PEstatus (event='1')= CMV_IgG_rev;
run;
990 proc logistic data= pe. matched_21_plus_co_inf_updated;
NOTE: Data file PE.MATCHED_21_PLUS_CO_INF_UPDATED.DATA is in a format that is native to another
host, or the file encoding does not match the session encoding. Cross Environment Data Access
will be used, which might require additional CPU resources and might reduce performance.
991 strata group;
992 class CMV_IgG_rev (ref='2');
993 format CMV_IgG_rev 1.;
994 model PEstatus (event='1')= CMV_IgG_rev;
995 run;
ERROR: Invalid reference value for CMV_IgG_rev.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 78 observations read from the data set PE.MATCHED_21_PLUS_CO_INF_UPDATED.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.20 seconds
cpu time 0.12 seconds
Maxim 3: Know Your Data.
Run a proc contents on your dataset (to see the type of CMV_IgG_rev) and a proc freq for variable CMV_IgG_rev.
Hi,
Thanks for the guidance! There was issue with my values in throriginal dataset which I could find after running proc freq.
wajs
Look at what is in your dataset.
data test;
set PE.MATCHED_21_PLUS_CO_INF_UPDATED;
formatted=quote(trim(vvalue( CMV_IgG_rev)));
raw = CMV_IgG_rev ;
run;
proc freq ;
tables raw*formatted / list missing;
run;
Hi Tom,
Thanks for this advice!
Here is the output; what should do wth "."?
The SAS System |
5 | 6.41 | 5 | 6.41 |
40 | 51.28 | 45 | 57.69 |
33 | 42.31 | 78 | 100.00 |
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.