BookmarkSubscribeRSS Feed
RobertNYC
Obsidian | Level 7

Hi all--

This may be a tricky question.

I use a Macro which password protects xml files. The macro %includeds a .vbs program.

options noxsync noxwait;

%include "X:\Programs\convert.sas";

%convert_files(default=X:\Datasets\Scores,ext=xml,password=test);

When the program runs it password protects every file in the folder with the same password -- in the case above "test. I need to change this so the password is different for every file.

The password starts with the letters ORE and then the code which is the first three characters in the file name.  

For file :

"700 FY13  Report.xml" The password needs to be ORE700

For file:

"B06 FY13  Report.xml" The password needs to be OREB06

For file:

"J10 FY13 Q1  Report.xml" The password needs to be OREJ10

Is there a way to read the first three characters of a file name and then use those characters in the password?

You feedback is appreciated!

1 REPLY 1
Patrick
Opal | Level 21

You don't show us your code so it's a bit hard to give you a concrete answer.

On a general level: Wouldn't a substring() function with the filename as source string give you what you need? ... substrn(scan("B06 FY13  Report.xml",-2,'/\.'),1,3)

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 644 views
  • 0 likes
  • 2 in conversation