SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

Creating a .csv File

Reply
N/A
Posts: 0

Creating a .csv File

When I create a .csv file is there any way to have the Label put into the first line instead of the Var Name?
Super Contributor
Super Contributor
Posts: 3,174

Re: Creating a .csv File

What SAS code are you using to create the CSV? For example, if you are using ODS CSV and combining that code with PROC PRINT, you can specify the LABEL parameter in PROC PRINT to use the LABEL instead of the variable name. If not using PROC PRINT, please share the SAS code you are using to generate the CSV.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: Creating a .csv File

I'm not using ODS - just a simple Proc Export:

PROC EXPORT DATA= mdata.fnl_adam_mems
OUTFILE="c:mdata\fnl_adam_mems.csv"
DBMS=CSV REPLACE;
RUN;
Super Contributor
Super Contributor
Posts: 3,174

Re: Creating a .csv File

After visiting the SAS support website http://support.sas.com/ I did a search using the argument "proc export label column" and one of the search results is the link below:

http://support.sas.com/kb/12/754.html

Scott Barry
SBBWorks, Inc.
Respected Advisor
Posts: 3,775

Re: Creating a .csv File

[pre]
ods csv file='csvWithLabels.csv';
proc print label noobs data=sashelp.shoes(obs=20);
run;
ods csv close;
[/pre]
N/A
Posts: 0

Re: Creating a .csv File

Hi Scott,

Thanks so much for your help. None of the Documentation I have included the LABEL parameter - how frustrating that the solution was so simple!

Liz
N/A
Posts: 0

Re: Creating a .csv File

Apparently I spoke too soon. When I run the following Proc Export code I get an error message stating that the (LABEL) option is not recognized:
PROC EXPORT DATA=contents OUTFILE="S:\Mdata\contents.csv" DBMS=CSV REPLACE LABEL;
RUN;

What am I doing wrong?
N/A
Posts: 0

Re: Creating a .csv File

I figured it out - we are using SAS 9.1.3 and LABEL will be available in 9.2
Ask a Question
Discussion stats
  • 7 replies
  • 267 views
  • 0 likes
  • 3 in conversation