BookmarkSubscribeRSS Feed
Barite | Level 11

Dear all,


I am using the following syntax in order to create Sas Metadata Folder:

x "/sas/SASPlatformObjectFramework/9.3/MakeFolder -host localhost -port 8591 -user &user -password &dbpass -makeFullPath /Rap/test/lev";


For the password I have tried to use:

filename pwfile '/path/text.txt';


proc sql noprint;
select strip(setting) into :pass
from sashelp.voption
where optname = "METAPASS";
select strip(setting) into :user
from sashelp.voption
where optname = "METAUSER";

proc pwencode in="%cmpres(&pass)" out=pwfile;

data _null_;
   infile pwfile obs=1 length=l;
   input @;
   input @1 line $varying1024. l;
   call symput('dbpass',substr(line,1,l));


However the procedure writes the pass in the text file something like this: {SAS975.....

when trying to pass the macro variable dbpass to x statement the folder is no longer created seems it tries to use the pass {SAS975..... and the pass does not match the user.


Is there a way not to use the password written clearly?


we are using AIX and we run batch scripts.


I have tried to use a profile file but there is none for the specific user.




Tourmaline | Level 20

Metadata passwords are always encoded/encrypted when stored, that's for a reason, I think you can guess why.


Let's turn around the question, why do you need to create Metadata Folders in code from a SAS program?

Do you plan to create loads of folders, and assign different authorization, and do this data driven?


Who will run this program, and when?

Data never sleeps
Barite | Level 11



We will have reports generated weekly and monthly and we'd like to store them in dedicated folder.

Thus when we run the reports we need to create subfolder, let's say, week1 and month1 and populate those folder.


When running the x statement the authorisation is inherited so we don't have to take care of this

(who evere has access to main folder shall access the subfolders also).


The alternative we have is to ask our colleagues from production to manually create this subfolders but we'd prefer create

them from scripts.


My colleagues from production only run a *.cmd file which register the tables in metadata - we need to create thos subfolders so the

tables are registered to their corresponding path.


I hope i have answered your questions.



Amethyst | Level 16

If that is the case, maybe you would like to integrate the process of create metadata folders in the SAS code.


Paul Homes describes it well with a simple macro as:

Barite | Level 11

Forget to mention I am using SAS 9.3.


Tourmaline | Level 20

I don't work that much with reports, what from your description, it sounds like static reports (pdf or similar). If so, is it necessary to store them in the metadata?

Also, if they are created regularly, you might want to consider a dynamic reports instead, using prompts, cube or whatever to get the information for the selected period.

When creating an infrastructure that needs continues adding of objects in the environment, my alarm bell rings...

Data never sleeps
Barite | Level 11

Actually there are sas tables which our users access using Sas-Add-INN.

They filter the data based on each user criteria and analyis the data.


We only keep 3 month of history therefore not so much data is registered within metadata.


I know about Paul Homes solution but he also proposes a new one replacing its macro, the

one i also use -



Rhodochrosite | Level 12

Since I wrote those 2 blog posts there is now a third method too (for SAS 9.4 users): sas-make-folder as described in the SAS 9.4 Intelligence Platform: System Administration Guide section on Batch Tools for Metadata Management.


Apart from my (outdated) macro which would be used inside a SAS process (such as a SAS Workspace Server) that already has an authenticated connection to the SAS metadata server, the other batch options require the provision of credentials/tokens to the SAS metadata server so they can authenticate that the originator as a valid user and then verify they have permissions to perform the action.  The credentials can be provided using the -user and -password options (the password can be pwencoded) or a -profile option where the credentials are provided in a connection profile (such as one created with SAS Management Console). If you don't want to use a (pwencoded) password either on the command line or in a profile, and your environment is configured to support Integrated Windows Authentication (IWA), then you might attempt that as an alternative (I haven't tried it myself yet so cannot confirm whether works for the batch tools).

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 4 in conversation