BookmarkSubscribeRSS Feed
davidmaron
Calcite | Level 5

Hi!

 

I am working through an example given by SAS to create relative risk from this example: http://support.sas.com/kb/23/003.html

 

I'm working through it but I am now stuck. I run the preceding code:

     

data question;
        input Gender $ Response $ Count;
        datalines;
      Women Yes 45
      Women  No 55
      Men   Yes 30
      Men    No 70
      ;
  

proc freq data=question order=data;
        weight Count;
        tables Gender*Response / relrisk;
        run;

      proc logistic data=question;
        freq count;
        class gender(ref="Men") / param=glm;
        model response(event="Yes")=gender;
        lsmeans gender / e ilink;
        ods output coef=coeffs;
        store out=ques;
        run;

 

So far, so good. HOWEVER, when I submit the suggested %NLMeans macro:

 

 %NLMeans(instore=ques, coef=coeffs, link=logit, options=ratio, title=Relative Risk);

 

I receive the following message:

 

"Warning: Apparent Invocation NLMeans not resolved"

 

Please advise! Thank you in advance!

 

 

Cheers,

David

 

 

5 REPLIES 5
FreelanceReinh
Jade | Level 19

Hi @davidmaron,

 

You need to download and submit the macro code from http://support.sas.com/kb/62/addl/fusion_62362_5_nlmeans.sas.txt in order to make it available to your SAS session.

Lucai_sister
Obsidian | Level 7

Hello, where do I start downloading the code? I started with "Macro Argument List Start" and copied the following code. However, I cannot display the results after using NLmeans. Could you please give me the specific process of using NLmeans? Since I am an initial scholar, I do not know how to use macros for the time being. Thank you very much.

FreelanceReinh
Jade | Level 19

Hello @Lucai_sister,

 

  1. First of all, make sure to use the latest version of the NLMeans macro:
    Under the "Downloads" tab on the page Sample 62362: Estimate and test differences, ratios, or contrasts of means in generalized linear mod... you find the current link, which is different from that provided in my reply from 2019 in this thread. Download the text file and save it as nlmeans.sas in a directory that your SAS session can access.

  2. Do the same for the NLEst macro, which is a prerequisite for the NLMeans macro:
    You find a link to the latest version of it under the "Downloads" tab on the page Sample 58775: Estimating nonlinear combinations of model parameters. Download the text file and save it as nlest.sas in the same directory as above.

  3. In your SAS session submit two %INCLUDE statements:
    %include 'your\path\nlest.sas';
    %include 'your\path\nlmeans.sas';
    (of course, with "your\path" replaced by the location you chose for the two .sas files).

  4. Use the code provided in a SAS Usage Note such as Usage Note 57798: Estimating relative risks in a multinomial response model to test the NLMeans macro. In this example you would submit
    - the DATA step creating the SCHOOL dataset,
    - the PROC LOGISTIC step creating the COEFFS dataset and the LOGMOD model item store
    - and finally the %NLMeans(...) macro call. 

    As a result you should obtain the table "School RRs on each Style" as displayed in the Usage Note. It appears that the latest version of NLMeans.sas creates an additional column "Null Value" in that table, but the values in the other columns (Estimate, Standard Error, etc.) match the numbers from the Usage Note (in spite of the warning about the final Hessian matrix in the log).

  5. Then you are ready to apply the NLMeans macro to your own data. Good luck! If you encounter problems in this Step 5, please start a new topic in the Statistical Procedures forum.

 

Hint: Generally, it is much better to open a new thread than to add questions to an old one (like from 2019), which only a few people will read.

pspen
Fluorite | Level 6

Hello,

 

I followed the instructions to download the latest macros and saved both on my laptop. I then did the following:


%inc 'C:\Users\rup9\Desktop\HearHer\nlmeans.sas';
%inc 'C:\Users\rup9\Desktop\HearHer\nlest.sas';

 

When I try running both, I get the WARNING: Physical file does not exist, C:\Users\rup9\Desktop\HearHer\nlest.sas.

 

What am I doing wrong? Please help! Thank you.

FreelanceReinh
Jade | Level 19

Hello @pspen,

 

Most likely, you don't have SAS installed on your laptop, but you are using an interface such as SAS Studio or SAS Enterprise Guide which connects to a server-based SAS installation. That server cannot access your local C: drive, hence the error. If you can copy and paste the code from nlmeans.sas and nlest.sas into the program editor of your interface and then submit it from there, this should be the easiest solution. Otherwise you need to upload the two .sas files to the server, e.g., to a location where other .sas files reside that you've been working with, so that the server can access the code (e.g., again via %include, but with the new server path replacing the local "C:\Users\..." path).

 

Good luck!

 

Finally, let me repeat the hint from my previous post in this thread:

@FreelanceReinh wrote:

Hint: Generally, it is much better to open a new thread than to add questions to an old one (like from 2019), which only a few people will read.


So, if you don't succeed with the copy/paste or upload approaches suggested above, please open a new thread so that people using SAS Studio or SAS Enterprise Guide can further assist you.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1706 views
  • 5 likes
  • 4 in conversation