BookmarkSubscribeRSS Feed
ren2010
Obsidian | Level 7
I was trying to save my log to a permanent location ,but when i mentioned the libname in the PROC PRINTTO ,i got an error saying INVALID FILE.

Here is my code:

PROC PRINTTO LOG='S:\DEV\user20\test\op' NEW;
RUN;
proc contents data=work noprint out=sample;
run;


PROC PRINTTO PRINT=PRINT LOG=LOG ;
RUN;
8 REPLIES 8
Cynthia_sas
SAS Super FREQ
Hi:
When I point to only a folder location, without a file extension, I get an error message:
[pre]
222 PROC PRINTTO LOG='c:\temp\output' NEW;
223 RUN;

ERROR: Invalid file, c:\temp\output.
NOTE: The SAS System stopped processing this step because of errors.
[/pre]

That's because PROC PRINTTO is expecting a FILENAME and FILE EXTENSION, as shown below:
[pre]
PROC PRINTTO LOG='c:\temp\contents1.log' NEW;
RUN;

proc contents data=work._all_ noprint out=sample1;
run;

PROC PRINTTO PRINT=PRINT LOG=LOG ;
RUN;

filename c2 'c:\temp\contents2.log';
PROC PRINTTO LOG=c2 NEW;
RUN;

proc contents data=work._all_ noprint out=sample2;
run;

PROC PRINTTO PRINT=PRINT LOG=LOG ;
RUN;
[/pre]

In addition, PROC CONTENTS expects a 2 level name either to a specific SAS dataset or the use of _ALL_ to indicate you want to see all the datasets in a SAS library.:
[pre]
proc contents data=work.mydata; /* specific dataset */
proc contents data=work._all_; /* ALL work datasets */
proc contents data=sashelp.class; /* specific dataset */
proc contents data=sashelp._all_; /* ALL SASHELP datasets */
[/pre]

So it looks to me like you potentially have one or two possible issues.

cynthia
ren2010
Obsidian | Level 7
Thanks Cynthia.
I created a folder 'OP' in and mentioned that folder name with .log extention in my code.This time i did not get any errors,but when i checked the folder to see the .log file,I did no see anything.Please advise.

sample code:

PROC PRINTTO LOG='S:\DEV\User20\op.log' NEW;RUN;
proc contents data=work._all_ noprint out=sample1;run;
PROC PRINTTO LOG=LOG ;RUN;
Cynthia_sas
SAS Super FREQ
Hi:
I'm confused. What do you expect to see??? You should see a message in the PRINTTO log output file that:
[pre]
NOTE: The data set WORK.SAMPLE1 has xx observations and yy variables.
[/pre]

and then you should also see the LOG messages from RUNNING the PROC CONTENTS, but there won't really be much here.

you will see in the output file WHATEVER you would normally see in the SAS log. So when I run this code,
[pre]
PROC PRINTTO LOG='c:\temp\contents1.log' NEW;
RUN;

proc contents data=work._all_ noprint out=sample1;
run;

PROC PRINTTO PRINT=PRINT LOG=LOG ;
RUN;
[/pre]

I get these results in the file c:\temp\contents1.log:
[pre]
NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


232
233 proc contents data=work._all_ noprint out=sample1;
234 run;

NOTE: The data set WORK.SAMPLE1 has 84 observations and 40 variables.
NOTE: PROCEDURE CONTENTS used (Total process time):
real time 0.04 seconds
cpu time 0.00 seconds


235
236 PROC PRINTTO PRINT=PRINT LOG=LOG ;
237 RUN;
[/pre]

Now, if you did something like this PROC OPTIONS:
[pre]
PROC PRINTTO LOG='c:\temp\options.log' NEW;
RUN;

proc options;
run;

PROC PRINTTO PRINT=PRINT LOG=LOG ;
RUN;
[/pre]

THEN, there'd be something to see in the PROC PRINTTO copy of the log(partial results):
[pre]
NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


240
241 proc options;
242 run;

SAS (r) Proprietary Software Release 9.2 TS2M2

Portable Options:

APPEND= Append at the end of the option value
APPLETLOC=C:\Program Files\SAS\SASGraphJavaApplets\9.2
Location of Java applets
ARMAGENT= ARM Agent to use to collect ARM records
ARMLOC=ARMLOG.LOG Identify location where ARM records are to be written
ARMSUBSYS=(ARM_NONE)
Enable/Disable ARMing of SAS subsystems
NOASYNCHIO Do not enable asynchronous input/output
AUTOSAVELOC= Identifies the location where program editor contents are auto saved
NOAUTOSIGNON SAS/CONNECT remote submit will not automatically attempt to SIGNON
BINDING=DEFAULT Controls the binding edge for duplexed output
BOMFILE Add Byte Order Mark when creating Unicode files
BOTTOMMARGIN=0.000 IN
Bottom margin for printed output
BUFNO=1 Number of buffers for each SAS data set
BUFSIZE=0 Size of buffer for page of SAS data set
[/pre]

If you are saying that you run the code and that the op.log file is NOT created, at all, then you have a question for Tech Support.

cynthia
ren2010
Obsidian | Level 7
Thanks.
The OP.LOG file is not created,like you suggested I will check with tech support.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The reply below from the OP is a bit concerning and possibly a confusion point:

"I created a folder 'OP' in and mentioned that folder name with .log extention in my code"

Based on the SAS code piece communicated in a prior reply - I would expect to see the file op.log in the directory User20 with "S:\DEV\" directory structure -- not in a sub-folder "op" under User20, if that is what was created. Here is the code I saw:

PROC PRINTTO LOG='S:\DEV\User20\op.log' NEW;RUN;

The information from prior posts is contradictory - possibly after doing some additional desk-checking, then post the exact SAS log where it is executed, rather than just pasting your code.

Scott Barry
SBBWorks, Inc.
ren2010
Obsidian | Level 7
Thanks SBB.

"I would expect to see the file op.log in the directory User20 with "S:\DEV\" directory structure " -
To save a log ,do I have to create/save an empty log,so that the PRINTTO prints the log to that log file?
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
No, the SAS system will create the file if it does not exist. Try it and see.

Scott Barry
SBBWorks, Inc.
ren2010
Obsidian | Level 7
Thanks SBB,it worked.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 8 replies
  • 2113 views
  • 0 likes
  • 3 in conversation