BookmarkSubscribeRSS Feed
bcb
Calcite | Level 5 bcb
Calcite | Level 5

So far I've not found an example of what I'm looking for. 

 

I know how to output a CSV file and email it using SAS 9.2 on z/OS using ODS CSV , PROC PRINT, and FILENAME OUTFILE EMAIL.  Problem is that for a dataset of even modest size (my dataset was 280K obs with 31 variables), the PROC PRINT processing takes a long time to run and consumes a lot of CPU. 

 

Is there a better way to get a CSV created without printed output from PROC print? My job took 45 minutes and consumed ten minutes of CPU..  For completeness, I did use the uniform and split options to create output that would contain meaningful headers.

 

I do have access to SAS EG and could probably get it to connect and read this file, but I'm a casual user of that, and only slightly more than a casual user of SAS z/OS...

8 REPLIES 8
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You can use proc export to create a csv file, its in the documentation.

You could create your csv via dataset and put statements.

 

I would really suggest however that email is not the way to send data.  Firstly it has size limitations and possible ther limitations depending on the IT group.  Secondly it is not secure when going anywhere other than internally, and even then may fail audit requirements.  Finally its not auditable, i.e. very little traceability.  Consider sending your file via FTP server, secure portal or something along those lines.

bcb
Calcite | Level 5 bcb
Calcite | Level 5
I am presently putting via ODS redirection, which is quick and easy, but burns a lot of CPU. PROC export is NOT available on z/OS. I already looked at that.
Cynthia_sas
SAS Super FREQ
You can always use a DATA step with PUT statements to write your own CSV file. I don't know whether it would be faster than ODS...it might be.

cynthia
ballardw
Super User

You may have the SAS supplied %ds2csv macro on your system.

If so something like:

%ds2csv(data=sashelp.class, runmode=B,csvfile=<your path>dummy.csv);

marko_kruz
Calcite | Level 5

Were you able to solve the issue? I'm facing the same problem 🙂

Tom
Super User Tom
Super User

@marko_kruz wrote:

Were you able to solve the issue? I'm facing the same problem 🙂


You can write a CSV file with a simple data step.  If you are running on MVS then lets assume you already have a FILEREF or even just a DDNAME created named CSV that points to where you want the CSV file written.  Let's assume the dataset you want to write out is named have.

 

To write a CSV file without a header line just use:

data _null_;
  file csv dsd ;
  set have;
  put (_all_) (+0);
run;

If you also need to write the header line then add a little bit more code.

proc transpose data=have(obs=0) out=names;
  var _all_;
run;
data _null_;
  file csv dsd ;
  set names ;
  put _name_ @ ;
run;
data _null_;
  file csv dsd mod;
  set have;
  put (_all_) (+0);
run;

 

 

Kurt_Bremser
Super User

Just use a DATA step to write the file.

The particulars for MVS (z/OS) have to go into the FILE statement. RECFM, LRECL etc.

Conversion from EBCDIC to ASCII will be done when the file is downloaded to UNIX/Windows.

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!

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
  • 8 replies
  • 1989 views
  • 4 likes
  • 8 in conversation