DATA Step, Macro, Functions and more

get proc export code

Posts: 43

get proc export code

Hi, I want to see the code generated by proc export while exporting my xls file. How can i get it?I dont see it in my log. The code is like:

But what if I am using it an excel file instead of csv. What should be the delimiter value in that case?(This code is copied from somewhere else)

data _null_;
9357 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
9358 %let _EFIREC_ = 0; /* clear export record count macro variable */
9359 file 'c:\test.csv' delimiter=',' DSD DROPOVER lrecl=32767;
9360 if _n_ = 1 then /* write column names or labels */
9361 do;
9362 put
9363 "x"
9364 ','
9365 "y"
9366 ','
9367 "z"
9368 ;
9369 end;
9370 set DS1(keep=x y) end=EFIEOD;
9371 format x best12. ;
9372 format y best12. ;
9373 format z best12. ;
9374 do;
9375 EFIOUT + 1;
9376 put x @;
9377 put y @;
9378 put z ;
9379 ;
9380 end;
9381 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
9382 if EFIEOD then call symputx('_EFIREC_',EFIOUT);
9383 run;

Frequent Contributor
Posts: 130

Re: get proc export code

Hi Maggi.

Sorry I'm answering your questions in reverse time order.

Please see my previous response to your subsequent question.

IF you still really need to understand the process, the SAS Institute supplies an autocall macro

%DS2CSV(data=yourlibrary.yourSASdataset, runmode=b, csvfile=yourpath/yourfile.csv);

If you can follow SAS Macro code, have a look at the the source code for that macro.

It will be

and it should be in one of your sas autocall locations for your UNIX SAS installation.

on my installation it is in the SAS install files in the





Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation