BookmarkSubscribeRSS Feed
mattl
Calcite | Level 5

Hi All,

 

I have a few hundred csv files which I need to register in DI Studio (so that they either appear under External Files in the inventory or are imported straight into a SAS library) I also need to set formats and lengths etc. I'd rather not do all of this manually through te wizard but cannot find a way of registering external files fully in code. The register external files wizard doesn't produce any code, just the INFILE statement.

 

I have a table which contains all, table names, field names, field types and lengths within all of the csv files and was hoping to be able to use macro code to loop over this and create everything on the fly.

 

Does anyone please have any ideas on how could this be implemented in DI Studio?

 

Thanks,

Matt

2 REPLIES 2
LinusH
Tourmaline | Level 20
I don't think that there's a solution out of the box.
You could use a document template as input to the External File wizard, which will minimise the manual input. But you still need to call the wizard for all files...

To loop through all you need to program something that utilises data step meta data functions, or proc metalib.

A third option would be if you could have your definitions stored in a tool supported by SAS Metadata Bridges. Haven't tested it for external files though...
Data never sleeps
Patrick
Opal | Level 21

A few hundred csv files sounds like you would want to explore some ways of automation but before going down this path:

Do all these csv's have different structures or are these just a few structures? If these are only a few structures then there are ways to create "metadata templates" instead.

 

I guess it's not only about the csv's but you also need the DIS jobs extracting the data and load it to somewhere. If you can give us a bit more detail what you have and how your process looks like then we can eventually show you alternative ways of how you could design and implement.

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 2 replies
  • 1126 views
  • 1 like
  • 3 in conversation