BookmarkSubscribeRSS Feed
maggi2410
Obsidian | Level 7

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;

1 REPLY 1
Damien_Mather
Lapis Lazuli | Level 10

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

ds2csv.sas

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

/core/sasmacro

folder

Cheers.

Damien

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 839 views
  • 0 likes
  • 2 in conversation