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;
Can someone advise where went wrong and how to fix it, thank you!
What version of SAS are you using?
If you are using 9.2 or later, use the PUTNAMES=NO statement.
What version of SAS are you using?
If you are using 9.2 or later, use the PUTNAMES=NO statement.
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;
..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 🙂
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: