BookmarkSubscribeRSS Feed
Flappyduck
Calcite | Level 5

Hi,

 

I'm looking for some help on creating some form of custom transformation to check the column headers a .csv file has when it get read into DI Studio.

 

I have a list of headers which should be in the table and when the file gets read in if it doesn't contain the correct headers, i want it will get moved to a check file so that the job doesn't fail. Any suggestions on the best way to set this up?

 

Thanks

1 REPLY 1
TomKari
Onyx | Level 15

Unfortunately, I don't have access to DI studio, so I'm not sure how these could be implemented.

If I were to try this in SAS code, I'd do one of the following:

1. Read in the file, but write the first line as a text string (if _n_ = 1) to one SAS dataset, and process the rest of the lines normally. In another step, do all of the checking needed on the header line, and then use macro processing to do the correct thing with the data.

2. Have a very basic data step, that splits the incoming dataset into two files, one with just the first line, and the other with all of the other lines. Then have a checking process to read in and check the one-line file, and set whatever macro variables are needed. Then process the other file, and based on the macro variables do something.

I hope maybe this gives you some thoughts for things that can be done in DI.

Tom

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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