Help using Base SAS procedures

proc pwencode

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 87
Accepted Solution

proc pwencode

Hi,

I'm using below code to encrypt my passwords. It was working fine until several jobs started to use the same .txt file and It gave me error saying that the .txt file is in use.

Can someone suggest if there is a way in proc pwencode where I can create a macro variable with encrypted value without writing it to the .txt files?

%let uid = ididid;
%let pid = ididid;

filename pwfile '/uhyy/xx/pwd.txt';

filename ppw '/uhyy/xx/ppw.txt';

  proc pwencode in='My_pwd' out=pwfile;
run;

proc pwencode in='My_pwd' out=ppw;

run;


   options symbolgen;


%macro readpwd(filename,var);

  data _null_;
   infile &filename obs=1 length=l;
   input @;
   input @1 line $varying1024. l;
   call symput("&var",substr(line,1,l));
run;

%mend;
%readpwd(pwfile,pwd);
%readpwd(ppw,ppwd);


Accepted Solutions
Solution
‎10-28-2013 12:04 PM
Super User
Super User
Posts: 6,499

Re: proc pwencode

Use the PATHNAME() function to get the filename. Or the FILENAME= option on the INFILE statement.

For EG there must be a method for downloading files, but if not then just read it into a dataset and download that.

View solution in original post


All Replies
Super User
Super User
Posts: 6,499

Re: proc pwencode

Use the TEMP filename engine to insure that you get a unique file created.  The file will be created in the WORK directory.

filename pwfile temp;

proc pwencode in='My_pwd' out=pwfile;

run;

Frequent Contributor
Posts: 87

Re: proc pwencode

Thank you!

Is there a way I can see the filename? and In EG how do i access work folder to see this file?

Solution
‎10-28-2013 12:04 PM
Super User
Super User
Posts: 6,499

Re: proc pwencode

Use the PATHNAME() function to get the filename. Or the FILENAME= option on the INFILE statement.

For EG there must be a method for downloading files, but if not then just read it into a dataset and download that.

Frequent Contributor
Posts: 87

Re: proc pwencode

Thank you!

Valued Guide
Posts: 2,175

Re: proc pwencode

alternatively,

eliminate contention for a data file by writing it into a  SAS catalog in your WORK library.

It is similar to the TEMP filename engine but persists a bit longer.

filename encrp temp lrecl=2048 ;

Creates a reference to a new file that will be lost when the filename encrp is closed with something like:

filename encrp ;

filename encry catalog 'work.work.work.source' lrecl=2048 ;

defines the reference encry, pointing to the source-type catalog entry work.source in the SAS catalog work.work. The source entry will persist until the end of the SAS session (or someone deletes it or deletes the catalog)

It can be used as if it is a plain text file.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 326 views
  • 3 likes
  • 3 in conversation