BookmarkSubscribeRSS Feed
wajs
Fluorite | Level 6

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

8 REPLIES 8
Astounding
PROC Star
So far, you haven't posted even a scrap of a SAS statement that would run without error. Guidance: post the log.
wajs
Fluorite | Level 6

Hi,

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;

 

Log:

288 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.
289 strata group;
290 class CMV_IgG_rev (ref='2');
291 model PEstatus (event='1')= CMV_IgG_rev;
292 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.08 seconds
cpu time 0.04 seconds

 

Tom
Super User Tom
Super User

Why do you have quotes around a numeric value?

Astounding
PROC Star
When you run a PROC CONTENTS on your data set, what do you see for CMV_lgG_rev?

Character or numeric?

Format?
wajs
Fluorite | Level 6

Hi, Thanks for the advice! Here is the output:

 

Variables in Creation Order# Variable Type Len Format Informat12345
groupNum8BEST12.BEST12.
typeChar7  
IDChar4$100.$100.
PEstatusNum8BEST12.BEST12.
CMV_IgG_revNum8BEST12.BEST12.
Astounding
PROC Star
OK, based on that here are two things to try. Admittedly these are educated guesses only!

First, add this statement as part of PROC LOGISTIC. It can never hurt and might help:

format CMV_lgG_rev;

Second, are you certain the quotes belong when using a numeric variable? Is it possible the syntax should be (as Tom mentioned):

class CMV_lgG_rev (ref=2);
wajs
Fluorite | Level 6

Thanks for the guidance!

After removing quotes, here is the log, it was the same whether I used format statement or not:

NOTE: The SAS System stopped processing this step because of errors.
307 strata group;
308 class CMV_IgG_rev (ref=2);
-
22
200
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, FIRST, LAST.
ERROR 200-322: The symbol is not recognized and will be ignored.
309 model PEstatus (event='1')= CMV_IgG_rev;
310 run;

 

Astounding
PROC Star

Sorry to say, I'm unable to help further.  I don't have access to LOGISTIC any more for testing purposes.

 

There must be a few stat gurus lurking who can finish this one!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1356 views
  • 0 likes
  • 3 in conversation