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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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