SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 41735: How to control variable names when using PROC EXPORT with comma, tab, or delimited files

DetailsOutputAboutRate It

Beginning in SAS® 9.2, you can use the the PUTNAMES= statement with PROC EXPORT to control whether or not variable names are written out to comma, tab, or delimited files. You can also use the PUTNAMES= statement with the LABEL option to write out labels instead of variable names with PROC EXPORT. By default, variable names are written to the first row of the external file (comma, tab, or delimited) when using PROC EXPORT.

Here is an example of using the PUTNAMES= statement to prevent variable names (headers) from being written to row 1 of the external file:

   proc export data=sashelp.class
               outfile='c:\temp\classnoheaders.csv'
     dbms=csv replace;
     putnames=no;
   run;

Here is an example of writing out the labels instead of variable names when using PROC EXPORT:

   /*Modify SASHELP.CLASS to include labels for variables*/
   data newclass;
     set sashelp.class;
     label name='First Name'
           sex='Gender'
           Age='Age of Person'
           Height='Height of Person'
           Weight='Weight of Person';
   run;
   proc export data=newclass outfile='c:\temp\classlabel.csv'
               label dbms=csv replace;
   run;



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemBase SASMicrosoft® Windows® for 64-Bit Itanium-based Systems9.2 TS1M0
Microsoft Windows Server 2003 Datacenter 64-bit Edition9.2 TS1M0
Microsoft Windows Server 2003 Enterprise 64-bit Edition9.2 TS1M0
Microsoft Windows XP 64-bit Edition9.2 TS1M0
Microsoft® Windows® for x649.2 TS1M0
Microsoft Windows Server 2003 Datacenter Edition9.2 TS1M0
Microsoft Windows Server 2003 Enterprise Edition9.2 TS1M0
Microsoft Windows Server 2003 Standard Edition9.2 TS1M0
Microsoft Windows XP Professional9.2 TS1M0
Windows Vista9.2 TS1M0
Windows Vista for x649.2 TS1M0
64-bit Enabled AIX9.2 TS1M0
64-bit Enabled HP-UX9.2 TS1M0
64-bit Enabled Solaris9.2 TS1M0
HP-UX IPF9.2 TS1M0
Linux9.2 TS1M0
Linux for x649.2 TS1M0
OpenVMS on HP Integrity9.2 TS1M0
Solaris for x649.2 TS1M0
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.