BookmarkSubscribeRSS Feed
SYN
Obsidian | Level 7 SYN
Obsidian | Level 7


I have one situation,

I have 3 different .CSV files and using file reader tranformation I have build the job for all 3 csv files.

I want to pass latest files every time using my user written code.

Can you please help me how to pass macro parameters.

Is there any simple way please let me know.

Thanks in advance.

Sreenivasa
3 REPLIES 3
jklaverstijn
Rhodochrosite | Level 12

Hi,

DI 3.4 may not support my approach; I haven't checked. What I do in 4.x, in a nutshell, is to

1) define the CSV in the metadata with a macro variable reference as the filename  (like &csvfile). make certain the generated code wraps this in double quotes or you're stuffed. This may actually be the breaking point for 3.4.

2) define and load a table that holds files present in your input location and keeps track of their processed status, eg through a timestamp.

3) Then in a job process that table in the first step to find out which file must be processed. Stick that value in a macro var. As the next step process the external file you defined in the metadata. Give that step a parameter to transfer the result from step 1 into the macro variable that matches the filename of the CSV file from 1). As a last step (or a subsequent job) mark the file as processed in the table as defined in 2).

Good luck, Jan.

shivas
Pyrite | Level 9

Hi SYN,

Check this link..it might be helpfull

https://communities.sas.com/message/129750#129750

This will help you in making a parameter file and you can resolve that in you DI,One more thing you need to do is to get the latest file.

Thanks,

Shiva

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
  • 1227 views
  • 0 likes
  • 3 in conversation