<?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 find test error rate after fitting the training data? in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/How-to-find-test-error-rate-after-fitting-the-training-data/m-p/454746#M6896</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that&amp;nbsp;you want to look into how to score a data set with a model that was fit on a different data set. This is a pretty good example of how to do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_logistic_sect066.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_logistic_sect066.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Apr 2018 14:05:32 GMT</pubDate>
    <dc:creator>svh</dc:creator>
    <dc:date>2018-04-17T14:05:32Z</dc:date>
    <item>
      <title>How to find test error rate after fitting the training data?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-to-find-test-error-rate-after-fitting-the-training-data/m-p/453844#M6891</link>
      <description>&lt;P&gt;This was a homework question I did in R. Now, I want to practice SAS coding.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I want to do it again in SAS to see if output match with what I did in R.&lt;/P&gt;&lt;P&gt;I do not know how to fit test data after I fit training data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I did, SAS 9.4 code I have so far:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc import out=work.car5&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;datafile= "C:\newRay\uofacourses\Stat441\assignment1\Auto1.csv" dbms=csv; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;getnames=yes; datarow=2;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data car6;&lt;BR /&gt;set work.car5;&lt;BR /&gt;if mpg&amp;gt;=23 then GC="Y";&lt;BR /&gt;else GC="N";&lt;BR /&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data train test;&lt;BR /&gt;set car6;&lt;BR /&gt;b=mod(year,2);&lt;BR /&gt;if b=0&lt;BR /&gt;then output train;&lt;BR /&gt;else output test;&lt;BR /&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc logistic data=train;&lt;BR /&gt;model GC = cylinders displacement horsepower weight acceleration year;&lt;BR /&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So, I import the auto data. I created a new variable called "GC" which means good car with mpg above median. So, GC=Y means yes it is a good car. otherwise is GC=N with mpg below median. I split the data into training and test data based on model year. Even year goes to training data. Odd year goes to test data. Then I fit logistic regression with training data.&lt;/P&gt;&lt;P&gt;This code works fine. I do not know what to do next.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, next I want to use the model fitted in training data for test data. Then find predicted outcome and compare to real outcome in test data. For test data,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Test error rate=("number of cases predicted as Y but real data is N"+"&lt;SPAN&gt;number of cases predicted as N but real data is Y")/total cases&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do this whole task in SAS?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also attach my data file. If anyone can help by providing some useful code or guide, I will appreciate it. Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 07:05:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-to-find-test-error-rate-after-fitting-the-training-data/m-p/453844#M6891</guid>
      <dc:creator>ainlayray</dc:creator>
      <dc:date>2018-04-13T07:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to find test error rate after fitting the training data?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/How-to-find-test-error-rate-after-fitting-the-training-data/m-p/454746#M6896</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that&amp;nbsp;you want to look into how to score a data set with a model that was fit on a different data set. This is a pretty good example of how to do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_logistic_sect066.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_logistic_sect066.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 14:05:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/How-to-find-test-error-rate-after-fitting-the-training-data/m-p/454746#M6896</guid>
      <dc:creator>svh</dc:creator>
      <dc:date>2018-04-17T14:05:32Z</dc:date>
    </item>
  </channel>
</rss>

