<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Create Empirical Logit Plots? (Proc Means in Empirical Logit) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696746#M79811</link>
    <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;! Thanks for your reply. Yeah I completely missed that seemingly small yet very important detail of checking to see whether my variable was character or numeric. Seems like that was def the issue. &lt;BR /&gt;&lt;BR /&gt;I ended up continuing on with the code I created and it seemed to create the plots I want. Thanks again for your help!!</description>
    <pubDate>Thu, 05 Nov 2020 01:59:31 GMT</pubDate>
    <dc:creator>asgee</dc:creator>
    <dc:date>2020-11-05T01:59:31Z</dc:date>
    <item>
      <title>How to Create Empirical Logit Plots? (Proc Means in Empirical Logit)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696686#M79807</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to asses non-linearity between a &lt;STRONG&gt;continuous predictor (fer)&lt;/STRONG&gt; and the &lt;STRONG&gt;logit of a binary outcome&lt;/STRONG&gt; &lt;STRONG&gt;variable (par)&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand that one way to visualize this is through an empirical logit plot. First off, I'm having trouble trying to find the exact syntax of how to produce these plots (I'm using SAS University edition so I think I can't use macros?).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To compute the empirical logit, my understanding is that you have to bin your continuous variable. Then, I would run a PROC MEANS procedure to produce the number of &lt;STRONG&gt;target event cases&lt;/STRONG&gt; (where par=1), and the number of&amp;nbsp;&lt;STRONG&gt;total&lt;/STRONG&gt; cases in each bin.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the code I have so far:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
run;

%global var;
%let var=fer;

proc rank data = want groups=100 out=work.ranks;
	var &amp;amp;var;
	ranks bin;
run;

title1 "Checking fer by bin";
proc print data=work.ranks(obs=10);
	var &amp;amp;var bin;
run;

proc means data=work.ranks noprint nway;
	class bin;
	var par &amp;amp;var;
	output out=work.bins sum(par)=par mean(&amp;amp;var)=&amp;amp;var;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;data&amp;nbsp;work.bins;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;set&amp;nbsp;work.bins;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;elogit=log((par+(sqrt(_FREQ_)/2))/
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(_FREQ_&amp;nbsp;-par+(sqrt(_FREQ_)/2)));
run;

title1&amp;nbsp;"Empirical&amp;nbsp;Logit&amp;nbsp;against&amp;nbsp;&amp;amp;var";
proc&amp;nbsp;sgplot&amp;nbsp;data=work.bins;
&amp;nbsp;&amp;nbsp;&amp;nbsp;reg&amp;nbsp;y=elogit&amp;nbsp;x=&amp;amp;var&amp;nbsp;/&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;curvelabel="Linear&amp;nbsp;Relationship?"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;curvelabelloc=outside
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lineattrs=(color=ligr);
&amp;nbsp;&amp;nbsp;&amp;nbsp;series&amp;nbsp;y=elogit&amp;nbsp;x=&amp;amp;var;
run;

title1&amp;nbsp;"Empirical&amp;nbsp;Logit&amp;nbsp;against&amp;nbsp;Binned&amp;nbsp;&amp;amp;var";
proc&amp;nbsp;sgplot&amp;nbsp;data=work.bins;
&amp;nbsp;&amp;nbsp;&amp;nbsp;reg&amp;nbsp;y=elogit&amp;nbsp;x=bin/
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;curvelabel="Linear&amp;nbsp;Relationship?"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;curvelabelloc=outside
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lineattrs=(color=ligr);
&amp;nbsp;&amp;nbsp;&amp;nbsp;series&amp;nbsp;y=elogit&amp;nbsp;x=bin;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My issue is that when I get to the &lt;U&gt;&lt;STRONG&gt;PROC MEANS STEP&lt;/STRONG&gt;&lt;/U&gt;, the line "&lt;U&gt;var par &amp;amp;var;&lt;/U&gt;" shows an error and says that "Variable par in list does not match type prescribed for this list". I've checked the frequencies of my "par" variable and it only contains "1" and "0" 's. Really confused on how to continue with creating the empirical logit plots.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again, I'm trying to create a plot where the y-axis is the LOGIT(par) and the x-axis is the continuous (fer) variable. If you have any other suggestions / tips / other methods on creating a plot that tests for this non-linearity, it'd be greatly appreciated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. I'm using the "Demo: Creating Empirical Logit Plots" video created by SAS as reference to all of the code I'm using:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.coursera.org/lecture/sas-predictive-modeling-using-logistic-regression/demo-creating-empirical-logit-plots-ouMSH?utm_source=link&amp;amp;utm_medium=page_share&amp;amp;utm_content=vlp&amp;amp;utm_campaign=top_button" target="_blank"&gt;https://www.coursera.org/lecture/sas-predictive-modeling-using-logistic-regression/demo-creating-empirical-logit-plots-ouMSH?utm_source=link&amp;amp;utm_medium=page_share&amp;amp;utm_content=vlp&amp;amp;utm_campaign=top_button&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 20:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696686#M79807</guid>
      <dc:creator>asgee</dc:creator>
      <dc:date>2020-11-04T20:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Empirical Logit Plots? (Proc Means in Empirical Logit)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696707#M79808</link>
      <description>&lt;P&gt;Would the effect plot from a univariate PROC LOGISTIC be similar enough or provide the same information? It's continuous rather than binned but otherwise seems the same....but I could be missing something.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shows an example of how to get an effect plot&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/How-to-Modify-Effect-Plots-In-Proc-Logistic/td-p/595037" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/How-to-Modify-Effect-Plots-In-Proc-Logistic/td-p/595037&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/308380"&gt;@asgee&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to asses non-linearity between a &lt;STRONG&gt;continuous predictor (fer)&lt;/STRONG&gt; and the &lt;STRONG&gt;logit of a binary outcome&lt;/STRONG&gt; &lt;STRONG&gt;variable (par)&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I understand that one way to visualize this is through an empirical logit plot. First off, I'm having trouble trying to find the exact syntax of how to produce these plots (I'm using SAS University edition so I think I can't use macros?).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To compute the empirical logit, my understanding is that you have to bin your continuous variable. Then, I would run a PROC MEANS procedure to produce the number of &lt;STRONG&gt;target event cases&lt;/STRONG&gt; (where par=1), and the number of&amp;nbsp;&lt;STRONG&gt;total&lt;/STRONG&gt; cases in each bin.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the code I have so far:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
run;

%global var;
%let var=fer;

proc rank data = want groups=100 out=work.ranks;
	var &amp;amp;var;
	ranks bin;
run;

title1 "Checking fer by bin";
proc print data=work.ranks(obs=10);
	var &amp;amp;var bin;
run;

proc means data=work.ranks noprint nway;
	class bin;
	var par &amp;amp;var;
	output out=work.bins sum(par)=par mean(&amp;amp;var)=&amp;amp;var;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;data&amp;nbsp;work.bins;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;set&amp;nbsp;work.bins;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;elogit=log((par+(sqrt(_FREQ_)/2))/
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(_FREQ_&amp;nbsp;-par+(sqrt(_FREQ_)/2)));
run;

title1&amp;nbsp;"Empirical&amp;nbsp;Logit&amp;nbsp;against&amp;nbsp;&amp;amp;var";
proc&amp;nbsp;sgplot&amp;nbsp;data=work.bins;
&amp;nbsp;&amp;nbsp;&amp;nbsp;reg&amp;nbsp;y=elogit&amp;nbsp;x=&amp;amp;var&amp;nbsp;/&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;curvelabel="Linear&amp;nbsp;Relationship?"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;curvelabelloc=outside
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lineattrs=(color=ligr);
&amp;nbsp;&amp;nbsp;&amp;nbsp;series&amp;nbsp;y=elogit&amp;nbsp;x=&amp;amp;var;
run;

title1&amp;nbsp;"Empirical&amp;nbsp;Logit&amp;nbsp;against&amp;nbsp;Binned&amp;nbsp;&amp;amp;var";
proc&amp;nbsp;sgplot&amp;nbsp;data=work.bins;
&amp;nbsp;&amp;nbsp;&amp;nbsp;reg&amp;nbsp;y=elogit&amp;nbsp;x=bin/
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;curvelabel="Linear&amp;nbsp;Relationship?"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;curvelabelloc=outside
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lineattrs=(color=ligr);
&amp;nbsp;&amp;nbsp;&amp;nbsp;series&amp;nbsp;y=elogit&amp;nbsp;x=bin;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My issue is that when I get to the &lt;U&gt;&lt;STRONG&gt;PROC MEANS STEP&lt;/STRONG&gt;&lt;/U&gt;, the line "&lt;U&gt;var par &amp;amp;var;&lt;/U&gt;" shows an error and says that "Variable par in list does not match type prescribed for this list". I've checked the frequencies of my "par" variable and it only contains "1" and "0" 's. Really confused on how to continue with creating the empirical logit plots.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again, I'm trying to create a plot where the y-axis is the LOGIT(par) and the x-axis is the continuous (fer) variable. If you have any other suggestions / tips / other methods on creating a plot that tests for this non-linearity, it'd be greatly appreciated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. I'm using the "Demo: Creating Empirical Logit Plots" video created by SAS as reference to all of the code I'm using:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.coursera.org/lecture/sas-predictive-modeling-using-logistic-regression/demo-creating-empirical-logit-plots-ouMSH?utm_source=link&amp;amp;utm_medium=page_share&amp;amp;utm_content=vlp&amp;amp;utm_campaign=top_button" target="_blank" rel="noopener"&gt;https://www.coursera.org/lecture/sas-predictive-modeling-using-logistic-regression/demo-creating-empirical-logit-plots-ouMSH?utm_source=link&amp;amp;utm_medium=page_share&amp;amp;utm_content=vlp&amp;amp;utm_campaign=top_button&lt;/A&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 22:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696707#M79808</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-04T22:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Empirical Logit Plots? (Proc Means in Empirical Logit)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696719#M79809</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;! Yes first I thought of that but not sure if that's the same as the Y-axis as the Logit of Outcome instead of the predicted probabilities... This is the sort of graph that I'm trying to replicate using my data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="asgee_0-1604530764236.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51388i41DF71ABB967BB8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="asgee_0-1604530764236.png" alt="asgee_0-1604530764236.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again my outcome is binary (0,1) and my variable is continuous. I checked the plots=all function on PROC LOGISTIC and cant seem to find a graph or a way to do this...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm assuming perhaps I can just do this manually, but not sure how to logit transform just my binary outcome variable and then just plot that logit(par) and continuous fer separate from running a PROC LOGISTIC....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 23:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696719#M79809</guid>
      <dc:creator>asgee</dc:creator>
      <dc:date>2020-11-04T23:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Empirical Logit Plots? (Proc Means in Empirical Logit)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696724#M79810</link>
      <description>I don't believe there's a default way in SAS but you need to bin your data and then graph it manually as you're trying. You can use macros in SAS UE by the way, not sure why you think you can't. &lt;BR /&gt;&lt;BR /&gt;Your error is because one of your variables (par/fer) is character when SAS expects a numeric variable to be summarized. Your variable type is the issue. I'm guessing it's with the variable par ...</description>
      <pubDate>Wed, 04 Nov 2020 23:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696724#M79810</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-11-04T23:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create Empirical Logit Plots? (Proc Means in Empirical Logit)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696746#M79811</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;! Thanks for your reply. Yeah I completely missed that seemingly small yet very important detail of checking to see whether my variable was character or numeric. Seems like that was def the issue. &lt;BR /&gt;&lt;BR /&gt;I ended up continuing on with the code I created and it seemed to create the plots I want. Thanks again for your help!!</description>
      <pubDate>Thu, 05 Nov 2020 01:59:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-Create-Empirical-Logit-Plots-Proc-Means-in-Empirical/m-p/696746#M79811</guid>
      <dc:creator>asgee</dc:creator>
      <dc:date>2020-11-05T01:59:31Z</dc:date>
    </item>
  </channel>
</rss>

