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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

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