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

it is very very slow. 

 


ODS CSV file="/ww/list.csv";
proc report data=temp;
columns customer_id;

define customer_id/display " customer_id";

run;
ODS CSV close;

 

any help?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Data steps still work with lots of variables, you can use formats and control the output. PROC EXPORT works, assign formats in the DATA step. Also, ODS CSV plus PROC PRINT works.

 

PROC REPORT is designed to make complicated reports, not appropriate for CSV files.

--
Paige Miller

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User

Why so complicated?

data _null_;
set temp;
file "/ww/list.csv";
if _n_ = 1 then put "customer_id";
put customer_id;
run;

No ODS or any output-creating procedure involved.

walterwang
Obsidian | Level 7
It is a very big file. a lot of columns. I want to use format to control the output.
PaigeMiller
Diamond | Level 26

Data steps still work with lots of variables, you can use formats and control the output. PROC EXPORT works, assign formats in the DATA step. Also, ODS CSV plus PROC PRINT works.

 

PROC REPORT is designed to make complicated reports, not appropriate for CSV files.

--
Paige Miller
walterwang
Obsidian | Level 7
use data steps to format the output. for example, date9. for date. use label to control the output name.

proc export data=temp1
outfile="/ww/list.csv"
label dbms=csv
replace;
run;

for 1G output, it only need minutes. which use proc report need two hours.
Tom
Super User Tom
Super User

@walterwang wrote:
It is a very big file. a lot of columns. I want to use format to control the output.

You need to provide a better example of your code then.  How many observations in the dataset? How many variables? 

 

What do you mean by "use format"? 

A CSV file has no "format".  It is just a text file.

 

Normal CSV file generation will use the formats attached to the variables to display the values.   If you want to display some of the values with a different format than is what is normally attached to the variable then perhaps you could just write the CSV with a data step and include a FORMAT statement in the data step.  

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1360 views
  • 0 likes
  • 4 in conversation