BookmarkSubscribeRSS Feed
CarolV
Fluorite | Level 6

I'm using SAS 9.4 and attempting to follow Cynthia's instructions for using tagsets.rtf style parskip / fonsize = .1pt to minimize (if not delete) the gap between Proc Report outputs on the same page. I'm using the following code (where the %create_rpt_a macro called loops through subjects and after each series of tables for a subject includes "ods rtf startpage=now;"):

 

ods noresults;

ods listing close;

proc template;

define style test2;

parent=styles.rtf;

style parskip / fontsize = .1pt;

end;

run;

ods tagsets.rtf file="&NewSharePath.\&rpt_name..rtf" options(select="NONE") startpage=NO style=test2 ;

options nocenter leftmargin=1.18in rightmargin=1in topmargin=1in bottommargin=1in ps=45;

ods escapechar='^';

 

footnote1 justify = left color = black font = 'Times New Roman' bold HEIGHT=10pt "CONFIDENTIAL AND PROPRIETARY " 'Page ^{pageof}';

 

%create_rpt_a;

ods _all_ close;

ods listing;

 

However, this code results in the following error:

    ERROR: Insufficient authorization to access C:\Windows\system32\sasrtf.rtf.

    ERROR: Fatal ODS error has occurred. Unable to continue processing this output destination.

 

This program must be run by users (including myself) on a Citrix server where we will not have write access to that C drive. Will we be able to use the approach Cynthia suggested under those constraints? If not, is there any other way to achieve the desired result?

 

 

8 REPLIES 8
ballardw
Super User

@CarolV wrote:

I'm using SAS 9.4 and attempting to follow Cynthia's instructions for using tagsets.rtf style parskip / fonsize = .1pt to minimize (if not delete) the gap between Proc Report outputs on the same page. I'm using the following code (where the %create_rpt_a macro called loops through subjects and after each series of tables for a subject includes "ods rtf startpage=now;"):

 

ods noresults;

ods listing close;

proc template;

define style test2;

parent=styles.rtf;

style parskip / fontsize = .1pt;

end;

run;

ods tagsets.rtf file="&NewSharePath.\&rpt_name..rtf" options(select="NONE") startpage=NO style=test2 ;

options nocenter leftmargin=1.18in rightmargin=1in topmargin=1in bottommargin=1in ps=45;

ods escapechar='^';

 

footnote1 justify = left color = black font = 'Times New Roman' bold HEIGHT=10pt "CONFIDENTIAL AND PROPRIETARY " 'Page ^{pageof}';

 

%create_rpt_a;

ods _all_ close;

ods listing;

 

However, this code results in the following error:

    ERROR: Insufficient authorization to access C:\Windows\system32\sasrtf.rtf.

    ERROR: Fatal ODS error has occurred. Unable to continue processing this output destination.

 

This program must be run by users (including myself) on a Citrix server where we will not have write access to that C drive. Will we be able to use the approach Cynthia suggested under those constraints? If not, is there any other way to achieve the desired result?

 

 


Did you really want to write the output to C:Windows\system32 folder?

You want the ODS file name to start with a drive and have all of the folders in the path for your destination. If you don't you get a relative path which almost always starts with part of the SAS executable in some form.

 

Large economy size hint:

Start with an example with absolutely no MACRO variables or calls. After that works you know what can be replaced and what the macro variables need to have.

 

I have a suspicion that you may not have had any definition for either the NEWSHAREPATH or the Rpt_name macro variables when the code executed. So defaults were used.

Cynthia_sas
SAS Super FREQ

Hi:

  The challenge is that you have to have someplace with write access. If you cannot write to the C: drive on the Citrix server, is there a mapped drive or a shared drive or a UNC resource name that you can write to?

 

  You can always write the template to the WORK location each time the job runs. And, you could write the RTF output to the WORK location too. However, there are 2 problems with this -- WORK is only accessible while the SAS session is active and the path name to WORK would be different EVERY time you started a SAS session on the server.

 

  If you can't write to the C: drive, I suggest you talk to the Citrix Admin and ask for an accessible location on the Citrix server where you can write your output and then, make sure that you can download from that location to a place where you can open the file with your PC.

 

Cynthia

CarolV
Fluorite | Level 6

Hi Cynthia,

 

Yes, I and all other users have access to the drive (&NewSharePath.\ ) where I write the rtf output . How do I get the template to get written to that same location? The rtf output gets written to this location with no problem when I use the following code (this code works beautifully except I have no way to control those pesky gaps between tables):

 

ods noresults;

ods listing close;

 

 

options nocenter leftmargin=1.18in rightmargin=1in topmargin=1in bottommargin=1in ps=45;

ods rtf file = "&NewSharePath.\&rpt_name..rtf" startpage=never;

 

ods escapechar='^';

 

footnote1 justify = left color = black font = 'Times New Roman' bold HEIGHT=10pt "CONFIDENTIAL AND PROPRIETARY   " 'Page ^{pageof}';

 

  %create_rpt_a;

 

ods rtf close;

 

So, when I switch to the ods tagsets method using Proc Template, how do I control where the template gets written to? What in the in the code I pasted with my original question triggered the program to try to write the template to C:\Windows\system32\sasrtf.rtf?

 

Thanks!

CarolV
Fluorite | Level 6

No, I do not want to write the output to the C drive. I want to write it to "&NewSharePath.\&rpt_name..rtf" which is on a drive which I and all users have access to. When I simply use the following code the output goes to that drive without error:

 

ods noresults;

ods listing close;

 

 

options nocenter leftmargin=1.18in rightmargin=1in topmargin=1in bottommargin=1in ps=45;

ods rtf file = "&NewSharePath.\&rpt_name..rtf" startpage=never;

 

ods escapechar='^';

 

footnote1 justify = left color = black font = 'Times New Roman' bold HEIGHT=10pt "CONFIDENTIAL AND PROPRIETARY   " 'Page ^{pageof}';

 

  %create_rpt_a;

 

ods rtf close;

 

 

It's only when I switch to ods tagsets that I get the error. I had assumed that it wasn't the output it was trying to write to the C drive, but the template. The &NewSharePath.\ works just fine.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, I am confused.  The code line (and note how I am using the code window - its the {i} above post to show code!):

 

ods rtf file="&NewSharePath.\&rpt_name..rtf" startpage=never;

Is essentially the same as:

 

ods tagsets.rtf file="&NewSharePath.\&rpt_name..rtf" startpage=no style=test2;

The only difference is the engine behind it.  If one can write to that location then the other can.  The error you present however is not saying that, it is saying that it cannnot write to a path on c drive.  So somewhere in your code either the macro variable newsharepath is not being set correctly, or you still have files open.

 

First, debug your code by putting:

options mlogic mprint symbolgen;

On, this will show what macro code is generated and what the variables are at given times.  Run through it, its likely you will see some oddity.  Probably a good idea to start a new session and do this.

If the problem still persists, then write a very simple bit of code and run in a new session to test:

%let newsharepath=...;

ods _all_ close;

ods rtf file="&newsharepath./test1.rtf" startpage=never;

proc print data=sashelp.class;
run;

ods rtf close;

ods tagsets.rtf file="&newsharepath./test2.rtf" startpage=never;

proc print data=sashelp.class;
run;

ods tagsets.rtf close;

This should create both files in that area, so you will be able to know that it is your code and not the system.  If that fails, post the full log in a code window.

CarolV
Fluorite | Level 6

Thank you for all your help. I determined what was causing the error. Within the macro portion of the code I had "ods rtf startpage=now;" When I comment that out it writes the rtf to the desired location with no errors. When I leave it it, it produces the error (ERROR: Insufficient authorization to access C:\Windows\system32\sasrtf.rtf)  So, it was not a problem with the macro value of the destination I'm writing to. I guess the problem was that the ods rtf method of inserting page breaks is incompatible with ods tagsets.

Cynthia_sas
SAS Super FREQ
HI:
Your ODS statement would have needed to be:
ods tagsets.rtf startpage=now;

That was the open destination. ODS RTF is not the same destination as ODS TAGSETS.RTF. So ODS thought you were trying to write to both destinations, but did not find a FILE= option for ODS RTF, so tried to write the STARTPAGE to a default location, which caused the error.

Possibly if you went back and used
ODS tagsets.rtf startpage=now;

there probably will not be an error message.

Cynthia
CarolV
Fluorite | Level 6

Thank you very much Cynthia. "ODS tagsets.rtf startpage=now;" worked.

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