BookmarkSubscribeRSS Feed
grodman
Obsidian | Level 7

Hello - 

 

I have a program that dynamically creates folders for a select group of customers utilizing the "dcreate" function (the folders need to have a naming convention of "Doe, John".)

 

I subsequently need to populate reports in those folders for each customer.  However, in order to do so, I need their customer ID.  Up until now, I have created a lookup table that contains both the customerID and the corresponding folder location.  So when I run a report that generates a PDF, the program will know for customerid X that the PDF needs to be placed a location Y.

 

However, managing the look up table has been problematic due to our need to add/remove folders from time to time.

 

Is there a way for me to store the customerID within the windows folder properties?  That would enable me to connect the customerID to the folder location without the need of an additional look up table.  I could then - hopefully - use the DINfo function to pull the customerID associated with the physical folder.

 

Does this ring a bell to anybody?  Any ideas?

2 REPLIES 2
Shmuel
Garnet | Level 18

Have you considered saving the PDF repoprts in a Folder/CusomerID subfolder ?

 

You wrote: "the program will know for customerid X that the PDF needs to be placed a location Y."

What information do you hold in "Y" subfolder name ? 

You may consider use Folder/CustomerId/Y or any other combination.

Tom
Super User Tom
Super User

It would be much easier on Unix filesystem. You could create one set of folders using NAME and another as symbolic links using the ID.  THen the program that is writing the files and only has the ID value could write to a folder based on the ID value and it would show up in the folder based on the NAME value.

 

data lookup ;
   infile cards dsd dlm='|' truncover ;
   input id name $40. ;
cards;
1|Doe, John
2|Smith, Mary
;

So your program to create the directory folder could run these Unix commands.

cd /top_level 
mkdir -p "by_name/Doe, John"
mkdir -p "by_name/Smith, Mary"
mkdir -p by_id
cd by_id 
ln -s "../by_name/Doe, John" 1
ln -s "../by_name/Smith, Mary" 2

Then the program that writes the files could generate the name using the id and the people/programs that look for them by name will see them.

 

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
  • 2 replies
  • 762 views
  • 2 likes
  • 3 in conversation