Hello,
I am using proc causalmed for survey data and would like to include sampling weights. However, I am unsure where to include the weight statement. I tried to include it after the covar statement but receive an error in SAS saying that the weight statement was out of order. Thanks!
PROC CAUSALMED DATA=;
CLASS;
MEDIATOR;
MODEL;
COVAR;
Hello @violet77,
The WEIGHT statement of PROC CAUSALMED was introduced in SAS/STAT 15.1. I'm using SAS/STAT 14.3 as part of SAS 9.4M5, where it was not available yet (compare the 14.3 documentation to the 15.1 documentation). So, for obvious reasons, I get the error message
20 weight w; ------ 180 ERROR 180-322: Statement is not valid or it is used out of proper order.
which I suspect is the same as you got.
Please check your SAS version with
%put &sysvlong;
or the SAS/STAT version with
proc product_status;
run;
I'm afraid I wouldn't know a workaround (other than an upgrade) if your version was the same as mine or older.
Hello,
I have never used PROC CAUSALMED (although I know what it is meant for) but I do not think the WEIGHT statement should get a particular place in the order of statements. Same for the COVAR statement.
I think it's best that you show us the LOG.
When you reply, hit the </> (Insert Code) button in the toolbar and paste the LOG in the pop-up window.
That way the LOG preserves structure and formatting which makes it easier to read.
Thanks,
Koen
Hello @violet77,
The WEIGHT statement of PROC CAUSALMED was introduced in SAS/STAT 15.1. I'm using SAS/STAT 14.3 as part of SAS 9.4M5, where it was not available yet (compare the 14.3 documentation to the 15.1 documentation). So, for obvious reasons, I get the error message
20 weight w; ------ 180 ERROR 180-322: Statement is not valid or it is used out of proper order.
which I suspect is the same as you got.
Please check your SAS version with
%put &sysvlong;
or the SAS/STAT version with
proc product_status;
run;
I'm afraid I wouldn't know a workaround (other than an upgrade) if your version was the same as mine or older.
Thanks! I have SAS/STAT 14.3. I appreciate your help! I will see if I can upgrade to 15.1
Hello,
I was able to get SAS/STAT 15.1. However, I ran into another issue. When I estimated my model with the weight statement, I received this message:
WARNING: The covariance matrix for the outcome model is not positive definite. The convergence is questionable.
WARNING: The covariance matrix for the mediator model is not positive definite. The convergence is questionable.
WARNING: Standard errors are not computed for the effect estimates.
Thanks!
This is most likely an issue with your input data. Please open a new thread (e.g., with subject line "Proc Causalmed: covariance matrix not positive definite") in this forum ("Statistical Procedures") so that all experts will see it. I'm still on SAS/STAT 14.3 and hence couldn't run your code even if I had similar input data.
Good luck!
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!
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.