BookmarkSubscribeRSS Feed
feenberg
Calcite | Level 5

I am using proc export to export a file to csv format with several thousand variables, and SAS writes more than 5,000 lines to the log file, which is a nuisance. Can that be suppressed somehow? I tried "nosource" but that has no effect.  It is SAS 9.4. If you don't believe me, here is an extract from the middle of a file with 74 variables:

 

505               ','
506                  "taxbc"
507               ','
508                  "s006"
509               ;
510             end;
511           set  _LAST_   end=EFIEOD;
512               format MARS best12. ;
513               format XTOT best12. ;
514               format EIC best12. ;
515               format f6251 best12. ;

It goes on for 315 lines for this small file. It looks like this output was intended for debugging problem exports. Surely there is a way to turn it off.

 

Daniel Feenberg 

3 REPLIES 3
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

use SAS log controls like nonotes and such.

here is a link to assist you with those SAS options that control your logging.

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279162.htm

 

Reeza
Super User
Option nonotes;

That’s one option, turn it on again after the export using the NOTES option. 

 

PROC PRINTTO is another as it redirects your log to an external file.

 


@feenberg wrote:

I am using proc export to export a file to csv format with several thousand variables, and SAS writes more than 5,000 lines to the log file, which is a nuisance. Can that be suppressed somehow? I tried "nosource" but that has no effect.  It is SAS 9.4. If you don't believe me, here is an extract from the middle of a file with 74 variables:

 

505               ','
506                  "taxbc"
507               ','
508                  "s006"
509               ;
510             end;
511           set  _LAST_   end=EFIEOD;
512               format MARS best12. ;
513               format XTOT best12. ;
514               format EIC best12. ;
515               format f6251 best12. ;

It goes on for 315 lines for this small file. It looks like this output was intended for debugging problem exports. Surely there is a way to turn it off.

 

Daniel Feenberg 


 

Tom
Super User Tom
Super User

The BEST way is to not use PROC EXPORT to create text files. It is trivial to write them using regular SAS code. In fact what you are complaining about is the ugly SAS code that PROC EXPORT generates.  You can create a delimited text file, with headers, in a single data step.  For one implementation of that method see this macro: https://github.com/sasutils/macros/blob/master/csv_vnext.sas

 

But probably the fastest way is to just modify your existing program to turn off the SOURCE option temporarily.

options nosource;
proc export data=sashelp.class file=csv dbms=dlm ;
run;
options source;
1474  options nosource;


NOTE: The file CSV is:

      Filename=xxxx.csv,
      RECFM=V,LRECL=32767,File Size (bytes)=0,
      Last Modified=04May2019:22:38:58,
      Create Time=04May2019:22:38:58

NOTE: 20 records were written to the file CSV.
      The minimum record length was 17.
      The maximum record length was 26.
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: DATA statement used (Total process time):
      real time           0.05 seconds
      cpu time            0.00 seconds


19 records created in CSV from SASHELP.CLASS.


NOTE: "CSV" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.14 seconds
      cpu time            0.00 seconds

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 627 views
  • 3 likes
  • 4 in conversation