Save To Layer File (Data Management)
Summary
Creates an output layer file (.lyr) that references geographic data stored on disk.
Usage
- 
This tool is used to save an in-memory layer, a layer file stored on disk, or a feature layer in ArcMap to a layer file (.lyr) that references geographic data stored on disk. 
- 
This tool accepts as input feature layers created by tools such as Make Feature Layer or Make XY Event Layer. 
- 
If the input layer has a selection applied to it, the output layer file will maintain this selection. 
- 
If the created layer file does not immediately show up in ArcCatalog, refresh the catalog tree. 
Syntax
| Parameter | Explanation | Data Type | 
| in_layer | The in-memory layer, layer file stored on disk, or feature layer in ArcMap to be saved to disk as a layer file (.lyr). | Layer | 
| out_layer | The output layer file (.lyr) to be created. | Layer File | 
| is_relative_path (Optional) | Determines if the output layer file (.lyr) will store a relative path to the source data stored on disk, or an absolute path. 
 | Boolean | 
Code Sample
The following Python Window script demonstrates how to use the SaveToLayerFile tool in immediate mode.
import arcpy
arcpy.env.workspace = "C:/data"
arcpy.SaveToLayerFile_management("studyquadsLyr", "C:/output/studyquadsLyr.lyr", "ABSOLUTE")
The following Python script demonstrates how to use the SaveToLayerFile tool in a stand-alone script.
# Name: SaveToLayerFile_Example2.py
# Description: Saves an inMemory layer to a file on disk
# Author: ESRI
# Import system modules
import arcpy
from arcpy import env
# Set workspace
env.workspace = "C:/data"
# Set local variables
in_layer = "studyquadsLyr"
out_layer = "studyquadsLyr.lyr"
#MakeFeatureLayer variables
in_features = "study_quads.shp"
out_layer0 = "studyquadsLyr"
where_clause = '"NAME" = 'LA MESA''
workspace = "C:/output"
try:
    # Execute MakeFeatureLayer
    arcpy.MakeFeatureLayer_management(in_features, out_layer0, where_clause, workspace)
    # Execute SaveToLayerFile
    arcpy.SaveToLayerFile_management(in_layer, out_layer, "ABSOLUTE")
except:
    print arcpy.GetMessages()