BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dbcrow
Quartz | Level 8

Hi, folks-

When I run this PROC CAUSALMED with a CLASS statement and reference values

 

proc causalmed data=data.climate23 decomp pmedmod poutcomemod;
	class healthharm_rc (ref="No") trans (ref="Cisgender");
	model healthharm_rc = housing_instab | trans;
	mediator housing_instab = trans;
	format healthharm_rc yesno_alt. trans trans. housing_instab housing_instab.; 
run;

 

I get this error: 

ERROR: Invalid reference value for trans.
ERROR: No valid observations due to invalid or missing values in the outcome,  mediator, treatment, explanatory, weight, or frequency variable.

The really weird thing is that when I use the same CLASS statement in PROC LOGISTIC, the code produces no errors: 

 

proc logistic data=data.climate23;
	class healthharm_rc (ref="No") trans (ref="Cisgender");
	model healthharm_rc = housing_instab | trans;
	format healthharm_rc yesno_alt. trans trans. housing_instab housing_instab.; 
run;

 

Even weirder, the above PROC CAUSALMED code was working just fine as recently as two weeks ago. I know that a workaround is (ref=FIRST), but it's really bugging me that code which worked so recently now doesn't. Also, it seems a surer bet to spell out the reference category rather than risk getting the SAS internal category order wrong--for example, (ref=LAST) would run but produce wrong results. 

 

Version info. is: 

- Base SAS: 9.4_M8

- EGP: 8.4 Update 2

- SAS/STAT: 15.3

 

Based on what I've read in five other posts in the support forums, here's what I've done so far in an attempt to fix the error: 

1) Checked formats to ensure that the spellings are the same in PROC FORMAT and the reference value in the CLASS statement; that there aren't any leading or trailing blanks, etc.   

 

proc format;
	value yesno_alt		0='No'
				1='Yes'
				.='Missing';

	value trans		0='Cisgender'
				1='Transgender';

	value housing_instab	0 = 'Very Stable'
				1 = 'Fairly Stable'
				2 = 'Somewhat Stable'
				3 = 'Fairly Unstable'
				4 = 'Very Unstable';
run;

 

2) Run PROC CONTENTS to see if that the above formats were properly attached to the corresponding variables. They are. 

3) Reset the SAS session and restarted SAS. 

 

Here's some sample data and code that reproduces the error: 

 

proc format;
	value yesno_alt		0='No'
				1='Yes'
				.='Missing';
value trans 0='Cisgender' 1='Transgender'; run; data person; infile datalines delimiter=','; input healthharm_rc trans mediator; datalines; 0,1,3 0,1,4 1,0,3 1,0,3 1,1,2 0,0,2 1,1,1 0,1,1 0,0,1 1,1,4 ; proc logistic data=person; class healthharm_rc (ref="No") trans (ref="Cisgender"); model healthharm_rc(event="Yes") = trans; format healthharm_rc yesno_alt. trans trans.; run; proc causalmed data=data.climate23; class healthharm_rc (ref="No") trans (ref="Cisgender"); model healthharm_rc = housing_instab | trans; mediator housing_instab = trans; format healthharm_rc yesno_alt. trans trans. housing_instab housing_instab.; run;

Any ideas? 

 

 

Thanks,

David

 

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

This appears to be a defect of some sort.  I would suggest that you contact Technical Support directly so they can investigate the issue.

View solution in original post

2 REPLIES 2
SAS_Rob
SAS Employee

This appears to be a defect of some sort.  I would suggest that you contact Technical Support directly so they can investigate the issue.

dbcrow
Quartz | Level 8
Have done so. I'll let you know the outcome.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 70 views
  • 1 like
  • 2 in conversation