When I attempt to use the code below, I receive an insufficient authorization to access error the first time. But when ran a second time it processes with no errors. I applied ods listing close as other posts indicated, but this does not help. Suggestions?
/* Show the current setting */
proc registry startat="CORE\PRINTING\PDF\DBCS" list;
run;
filename source 'temp.sasxreg';<<<<-this is where the error occurs
data _null_;
file source;
put '[CORE\PRINTING\PDF\DBCS]';
put ' "Searchable" = "Yes"';
run;
/* Change the SAS registry */
proc registry import=source; *usesashelp;
run;
/* Show the current setting */
proc registry startat="CORE\PRINTING\PDF\DBCS" list;
run;
Why not use a temporary file in the WORK location?
filename source temp;
Why not use a temporary file in the WORK location?
filename source temp;
And please post the complete log from both tries, using the </> button (7th icon).
Attempt #1
0 /******************************pdf formatting options*************************/
31 ods listing close;
32 /* Show the current setting */
33 proc registry startat="CORE\PRINTING\PDF\DBCS" list;
34 run;
NOTE: Contents of SASHELP REGISTRY starting at subkey [CORE\PRINTING\PDF\DBCS]
[ CORE\PRINTING\PDF\DBCS]
Searchable="No"
NOTE: Contents of SASUSER REGISTRY starting at subkey [CORE\PRINTING\PDF\DBCS]
[ CORE\PRINTING\PDF\DBCS]
Searchable="Yes"
NOTE: PROCEDURE REGISTRY used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
35
36 filename source 'temp.sasxreg';
37
38 data _null_;
39 file source;
40 put '[CORE\PRINTING\PDF\DBCS]';
41 put ' "Searchable" = "Yes"';
42 run;
ERROR: Insufficient authorization to access I:\BIConfig\Lev1\SASApp\temp.sasxreg.
2 The SAS System Wednesday, April 1, 2020 09:42:00 AM
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
43
44 /* Change the SAS registry */
45 proc registry import=source; *usesashelp;
46 run;
NOTE: Parsing REG file and loading the registry please wait....
NOTE: Registry IMPORT is now complete.
NOTE: PROCEDURE REGISTRY used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
47
48 /* Show the current setting */
49 proc registry startat="CORE\PRINTING\PDF\DBCS" list;
50 run;
NOTE: Contents of SASHELP REGISTRY starting at subkey [CORE\PRINTING\PDF\DBCS]
[ CORE\PRINTING\PDF\DBCS]
Searchable="No"
NOTE: Contents of SASUSER REGISTRY starting at subkey [CORE\PRINTING\PDF\DBCS]
[ CORE\PRINTING\PDF\DBCS]
Searchable="Yes"
NOTE: PROCEDURE REGISTRY used (Total process time):
real time 0.01 seconds
cpu time 0.03 seconds
Now I cannot replicate the issue with running it a second time. Your suggestion for using "temp" instead produced no errors. As long as it does not cause issues in the SAS registry I'm good with that (see below):
Attempt #2 using work area instead:
29 /******************************pdf formatting options*************************/
30 ods listing close;
31 /* Show the current setting */
32 proc registry startat="CORE\PRINTING\PDF\DBCS" list;
33 run;
NOTE: Contents of SASHELP REGISTRY starting at subkey [CORE\PRINTING\PDF\DBCS]
[ CORE\PRINTING\PDF\DBCS]
Searchable="No"
NOTE: Contents of SASUSER REGISTRY starting at subkey [CORE\PRINTING\PDF\DBCS]
[ CORE\PRINTING\PDF\DBCS]
Searchable="Yes"
NOTE: PROCEDURE REGISTRY used (Total process time):
real time 0.01 seconds
cpu time 0.03 seconds
34
35 filename source 'temp';
36
37 data _null_;
38 file source;
39 put '[CORE\PRINTING\PDF\DBCS]';
40 put ' "Searchable" = "Yes"';
41 run;
NOTE: The file SOURCE is:
Filename=I:\BIConfig\Lev1\SASApp\temp,
2 The SAS System Wednesday, April 1, 2020 09:42:00 AM
RECFM=V,LRECL=32767,File Size (bytes)=0,
Last Modified=01Apr2020:09:47:37,
Create Time=01Apr2020:09:42:29
NOTE: 2 records were written to the file SOURCE.
The minimum record length was 21.
The maximum record length was 24.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.04 seconds
42
43 /* Change the SAS registry */
44 proc registry import=source; *usesashelp;
45 run;
NOTE: Parsing REG file and loading the registry please wait....
NOTE: Registry IMPORT is now complete.
NOTE: PROCEDURE REGISTRY used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds
46
47 /* Show the current setting */
48 proc registry startat="CORE\PRINTING\PDF\DBCS" list;
49 run;
NOTE: Contents of SASHELP REGISTRY starting at subkey [CORE\PRINTING\PDF\DBCS]
[ CORE\PRINTING\PDF\DBCS]
Searchable="No"
NOTE: Contents of SASUSER REGISTRY starting at subkey [CORE\PRINTING\PDF\DBCS]
[ CORE\PRINTING\PDF\DBCS]
Searchable="Yes"
NOTE: PROCEDURE REGISTRY used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
As I expected, the ERROR does not occur at the filename statement, but when you try to write to the file reference.
The clue to the cause is this:
I:\BIConfig\Lev1\SASApp\temp.sasxreg
Since you did not give an absolute file path, starting at a drive letter, SAS tried to write the file in its Current Working Directory, which lies in the configuration tree and where you do not have write permissions.
Always supply an absolute path pointing to a location where you are allowed to write, or use a temporary file reference.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.