BookmarkSubscribeRSS Feed
danimian
Calcite | Level 5

Hi,

I have to compare folder name saved on server (e.g. 2013) with value in table (e.g. where year is 2013). If a match found then read all files from this folder.

My Idea is to to save a folder name in var1 and value from table in var2. If they are equal then go to next transformation.

The problem is i am very new to DI Studio and need some suggestion and right way to implement it?

Thanks in Advance and Best Regards

Dani

3 REPLIES 3
LinusH
Tourmaline | Level 20

I'm not sure how to compare a name on a folder - don't you need to specify the name of the folder in some way first? Or do you mean that you want to if a folder with a specific name exists, if yes, then import all files?

I suggest some pre-code, or User written that searches for the folder with appropriate name, if exists, import the folder contents to SAS table. Then use the lopp transform that calls the job where you actually import the file, using the "folder" SAS table as input to parameterize the called job.

Or, if the files have identical structure, you may use aggregate filename technique.

Data never sleeps
danimian
Calcite | Level 5

I am using user written transformation where i save my folder name in a var1 and then giving the whole path in another var2 concat with this var1. At the end with a boolean value of var2 0 or 1 i can identify exist or not.

Thanks for answer.

LinusH
Tourmaline | Level 20

So, it's not parameterized for the job, path and folder name are "hard coded" for each job that uses the transforamtion?

You use the dopen function, check the return code.

Data never sleeps

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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1016 views
  • 3 likes
  • 2 in conversation