DATA Step, Macro, Functions and more

Export csv without varible label

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

Export csv without varible label

Dear all,

I'm trying to generate a set of random data and export then Numpy in Python environment can read and work on. So I would export the data without var label and learned below and code as attached with label x='00'x, but x is still there, see attached csv

data MYSECOND.BIRANDOM;
call streaminit(1234);
do i=1 to 100;
   x=rand("normal", 20, 3);
   /*y=0;*/
   output;
   end;
do i=101 to 200;
   x=rand("normal", 30, 3);
   output;
   /*y=0;*/
   end;
Drop i;   
run;   
proc print data=mysecond.birandom; var x; label x='00'x; 
run;
/* Option group 5 (GRAPH SIZE) parameters. */
/*--Set output size--*/
ods graphics / reset imagemap;

/*--SGPLOT proc statement--*/
proc sgplot data=mysecond.BIRANDOM;
	/*--Histogram settings--*/
	histogram x / scale=COUNT SHOWBINS;

	/*--Vertical or Response Axis--*/
	yaxis grid;
run;

/*ods graphics / reset;
ods noproctitle;
ods graphics / imagemap=on;

proc princomp data=mysecond.BIRANDOM plots(only)=(scree);
	var x y;
run;*/
/* Stream a CSV representation of SASHELP.CARS directly to the user's browser. */

proc export data=mysecond.birandom
            outfile="/folders/myfolders/MySimulation/birandom.csv"
            dbms=csv 
            replace;
            label;
run;

%let _DATAOUT_MIME_TYPE=text/csv;
%let _DATAOUT_NAME=birandom.csv;

http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n17dcq1elcvpvkn1pkecj...

 

Can someone advise where went wrong and how to fix it, thank you!


Accepted Solutions
Solution
‎11-03-2017 03:28 AM
PROC Star
Posts: 1,410

Re: Export csv without varible label

Posted in reply to Michaelcwang2

What version of SAS are you using?

 

If you are using 9.2 or later, use the PUTNAMES=NO statement.

View solution in original post


All Replies
Solution
‎11-03-2017 03:28 AM
PROC Star
Posts: 1,410

Re: Export csv without varible label

Posted in reply to Michaelcwang2

What version of SAS are you using?

 

If you are using 9.2 or later, use the PUTNAMES=NO statement.

Contributor
Posts: 23

Re: Export csv without varible label

Hi Draycut,
It works and thank you!
Super User
Super User
Posts: 8,289

Re: Export csv without varible label

Posted in reply to Michaelcwang2

You want to create a CSV file without the header row?

Then just use a DATA step.

data _null_;
  set mysecond.birandom;
  file "/folders/myfolders/MySimulation/birandom.csv" dsd ;
  put (_all_) (+0);
run;
Contributor
Posts: 23

Re: Export csv without varible label

Hi Tom,
Also appreciate your response.
PROC Star
Posts: 1,410

Re: Export csv without varible label

..though I completely agree with @Tom that the best way to do it is with the FILE statement in the data step. But since you had already written an EXPORT procedure, this was probably the quickest and dirtiest fix Smiley Happy

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 387 views
  • 0 likes
  • 3 in conversation