BookmarkSubscribeRSS Feed
jkburkemiller
Calcite | Level 5

Hello!

 

I'm analyzing MEPS data and want to look at adjusted prevalence ratios resulting from PROC SURVEYLOGISTIC models. I've downloaded and run NLMeans and NLEst macros. This is the code I'm trying (location, exposure1, exposure2, and dependentvariable are placeholders for actual names).

 

%include "C:\location\nlmeans.sas" ;
%include "C:\location\nlest.sas" ;

proc surveylogistic data= MEPS;
strata VARSTR;
cluster VARPSU;
weight PERWT21F;
domain substudy ;
class exposure1 exposure2 / param=glm ref=first;;
model dependentvariable (desc) = exposure1 exposure2 ;
lsmeans exposure1 / e ilink;
ods output coef=coeffs;
store out=ques;
run;
%nlmeans(instore=ques, coef=coeffs, link=logit, options=ratio,
null=1, title=Relative Risk);

 

The error message is: WARNING: Output 'coef' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce
the requested output object. For example, verify that the NOPRINT option is not used.

 

I'm not used to running macros so I expect it's a novice mistake!

 

Thank you,

Jane

9 REPLIES 9
Tom
Super User Tom
Super User

Make sure the start debugging from the first error (or unexpected result) as later errors might just be side effects of the earlier ones.

 

Most likely the data was not appropriate for the analysis so the output you wanted was not created. 

 

Make sure to turn on the MPRINT option before calling the macro so you can see in the SAS log what actual SAS code the macro was trying to run.

Ksharp
Super User

Firstly using ODS TRACE to check whether  the  output object name contains "COEF" or not.

You need to use "lsmeans" to get "COEF" object.

Here is an example:

 

ods trace on;
proc logistic data=sashelp.heart(obs=1000);
class sex bp_status/ param=glm;
model status=sex bp_status weight height;
lsmeans sex / e ilink;
 ods output coef=coeffs;
        store out=ques;
run;
ods trace off;

Ksharp_0-1770965131480.png

 

And better to post your question at Stat Forum:

https://communities.sas.com/t5/Statistical-Procedures/bd-p/statistical_procedures

jkburkemiller
Calcite | Level 5

Thank you! 

The log indicates that output was added, including for coef and lsmeans but then the error happens "ERROR: File WORK.EST.DATA does not exist.":

 

NOTE: The SURVEYLOGISTIC procedure generated the model item store WORK.QUES.
NOTE: The data set WORK.COEFFS has 24 observations and 10 variables.
NOTE: PROCEDURE SURVEYLOGISTIC used (Total process time):
real time 5.29 seconds
cpu time 3.48 seconds


1882 ods trace off;
1883 %nlmeans(instore=ques, coef=coeffs, link=logit, options=ratio,
1884 null=1, title=Relative Risk);
MPRINT(NLMEANS): options nonotes nomprint nomlogic
ERROR: File WORK.EST.DATA does not exist.
WARNING: The data set WORK.EST1 may be incomplete. When this step was stopped there were 0
observations and 0 variables.
NOTE: The data set EST1 has been created for estimate set 1 in COEF.
ERROR: File WORK.EST.DATA does not exist.
WARNING: The data set WORK.EST2 may be incomplete. When this step was stopped there were 0
observations and 0 variables.
NOTE: The data set EST2 has been created for estimate set 2 in COEF.
NOTE: The NLMEANS macro used 1.48 seconds.

 

 

jiltao
SAS Super FREQ

So is the error about coef in PROC SURVEYLOGISTIC or about est1 in the NLMEANS macro?

Make sure you are running the most recent version of the macro.

Jill

StatDave
SAS Super FREQ

Specifically the part labeled "Domain processing" which uses the RunBY macro in addition.

FreelanceReinh
Jade | Level 19

Hello @jkburkemiller and welcome to the SAS Support Communities!

 

The warning message is from the ODS OUTPUT statement in your PROC SURVEYLOGISTIC step, so you can focus on this step. It cannot be caused by the subsequent %NLMEANS macro call. Of course, output 'coef' not being created means that the NLMEANS macro will either issue the error message

ERROR: Required COEF= data set not specified or not found.

or use an outdated dataset COEFFS if one exists.

 

To find out why the LSMEANS statement (via ODS OUTPUT) does not create the COEFFS dataset, you should first check the log (as Tom has already recommended) for preceding error messages such as

ERROR: There are no valid observations.

and look at the values of the relevant variables in a couple of observations. There is a good chance that this will clarify the issue. Otherwise, you may want to simplify the PROC SURVEYLOGISTIC step temporarily, e.g., comment out the CLUSTER statement or omit variable EXPOSURE2 from the CLASS and MODEL statements, and see if the warning still occurs.

StatDave
SAS Super FREQ

I think the problem relates to your use of a DOMAIN statement in SURVEYLOGISTIC. See "BY Group or Domain Processing" in the Details section of the NLMeans macro documentation then see the example in the Results tab that shows how to use NLMeans with a domain analysis.

Ksharp
Super User
As @StatDave indicated, check
EXAMPLE 5: BY group processing, domain analysis, analysis of imputed data, and using where=

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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
  • 9 replies
  • 763 views
  • 8 likes
  • 7 in conversation