Help using Base SAS procedures

Using proc printto correctly

Reply
N/A
Posts: 0

Using proc printto correctly

I'm new to SAS and I'm trying to use the proc printto to save my log and I can't get it work right.

I'm trying to reformat character fields into dates on a very large dataset (150 million cases) and as it's running the log fills up and I have to choose one of the options on the window to get it started again. I saw another post where someone else had the same issue and I've tried running the proc printto code but it's not working. The log is not being saved and I get that same window popping up when the log gets full.

I'm guessing that I either don't have the code in the right place or order, or maybe I don't even have the right code. I'm using 9.2 on Windows Vista.

I found this first part on the SAS site and 'myfile' was what they had and I'm not sure what it should be so I left it like it was. The file reference 'N:\Cm_files\date.log' is where I want the log saved.

filename myfile 'N:\Cm_files\date.log';
proc printto log=myfile;
run;

data cm_files.cm_files_merged_9_27_10;
set cm_files.cm_files_merged_9_27_10;
cm_exit_dt=input(cm_exit_date,yymmdd8.);
cm_participation_dt=input(cm_participation_date,yymmdd8.);
birth_dt=input(birth_date,yymmdd8.);
service_begin_dt=input(service_begin_date,yymmdd8.);
service_end_dt=input(service_end_date,yymmdd8.);
cm_attain_deg_cert_dt=input(cm_attain_deg_cert_date,yymmdd8.);
cm_fedrpt_dislocation_dt=input(cm_fedrpt_dislocation_date,yymmdd8.);
cm_first_dol_youth_service_dt=input(cm_first_dol_youth_service_date,yymmdd8.);
cm_first_youth_service_dt=input(cm_first_youth_service_date,yymmdd8.);
cm_fys_lit_num_date=input(cm_fys_lit_num_dt,yymmdd8.);
cm_youth_complete_dt=input(cm_youth_complete_date,yymmdd8.);
fund_source_begin_dt=input(fund_source_begin_date,yymmdd8.);
fund_source_end_dt=input(fund_source_end_date,yymmdd8.);
qualifying_dislocation_dt=input(qualifying_dislocation_date,yymmdd8.);
revision_dt=input(revision_date,yymmdd8.);
format cm_exit_dt cm_participation_dt birth_dt service_begin_dt service_end_dt cm_attain_deg_cert_dt cm_fedrpt_dislocation_dt
cm_first_dol_youth_service_dt cm_first_youth_service_dt cm_fys_lit_num_date cm_youth_complete_dt fund_source_begin_dt
fund_source_end_dt qualifying_dislocation_dt revision_dt yymmddn8.;
put cm_exit_dt cm_participation_dt birth_dt service_begin_dt service_end_dt cm_attain_deg_cert_dt cm_fedrpt_dislocation_dt
cm_first_dol_youth_service_dt cm_first_youth_service_dt cm_fys_lit_num_date cm_youth_complete_dt fund_source_begin_dt
fund_source_end_dt qualifying_dislocation_dt revision_dt=;
run;

Thanks for any suggestion y'all may have,
Angie
Super Contributor
Posts: 281

Re: Using proc printto correctly

Posted in reply to deleted_user
As far as I can see, this should work.

Are you sure you have write access to this location, that you have typed it properly, and there is plenty of space to write this very large log file?

Side comment: why write this to a network drive? That's much slower than writing it to your C: drive.
SAS Employee
Posts: 19

Re: Using proc printto correctly

Posted in reply to deleted_user
Try a simple, short data set with the same proc printto statement as a test of whether or not the log is being save to the file. That would be the first step I would try.

Do you need to see every data value in the log? That's what you're getting with the put statement.
SAS Employee
Posts: 19

Re: Using proc printto correctly

Posted in reply to martha_sas
Do you know about the "new" option for proc printto? Without that, proc printto will append to an existing file, rather than replace what's already there. If you want to replace, use

proc printto log=myfile new;
run;
Ask a Question
Discussion stats
  • 3 replies
  • 192 views
  • 0 likes
  • 3 in conversation