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 🙂

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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