BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Michaelcwang2
Obsidian | Level 7

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!

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

What version of SAS are you using?

 

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

Michaelcwang2
Obsidian | Level 7
Hi Draycut,
It works and thank you!
Tom
Super User Tom
Super User

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;
Michaelcwang2
Obsidian | Level 7
Hi Tom,
Also appreciate your response.
PeterClemmensen
Tourmaline | Level 20

..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 🙂

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 5148 views
  • 2 likes
  • 3 in conversation