title: Exporting selected attributes in ArcGIS to a new layer using python (ArcMap 10.5.1)?
body: <p>I have a file with data from 25 different years and I need to export the data in each individual year into a new shapefile.  I have already coded a way to select the files but now I need help exporting the data from the year that I selected into a new shapefile.  The selection of the year involves the SelectLayerByAttribute_management function if that helps gives you an idea of how I coded for the selection.  For practical purposes just say that the main file that I am pulling the data out of is called "Customers" and I would like to export the individual years into new shapefiles called "Customers_20xx".</p>
  
  <pre><code>&gt;&gt;&gt; import arcpy
  &gt;&gt;&gt; arcpy.SelectLayerByAttribute_management("Customers", "NEW_SELECTION", "Year=1989")
  &lt;Result 'Customers'&gt;
  </code></pre>
  
  <p>That part works. When I enter that code every data set that was from the year 1989 in the file "Customers" is selected. Now it is just a matter of exporting the selected data into a new files called "Customers_1989" – PythonPerson 2 hours ago</p>