Hi,
I'm looking for ideas on how to handle error conditions from a missing or renamed tab when using Proc Import in a batch mode. I've been asked to read in a lot of older excel files, each of which has multiple tabs. I can easily detect if the file itself is present with the fileexist() function. Not so much with a missing or mis-named tab within the spreadsheet.
Each proc import is followed by a data step to transform it, then a proc append. If proc import doesn't find the tab, it won't create the output file as it doesn't know what to put in it. The data step then chokes on a missing input dataset.
Thanks!
--Ben
You could try a LIBNAME statement with the EXCEL option. When you assign your LIBNAME to a workbook, all of the tabs will be listed in a PROC CONTENTS of the library. You could also use the EXIST function to test if a tab is present or not.
You could try a LIBNAME statement with the EXCEL option. When you assign your LIBNAME to a workbook, all of the tabs will be listed in a PROC CONTENTS of the library. You could also use the EXIST function to test if a tab is present or not.
Of course. Then I can get direct access to what they -really- used for tab names and conditionally execute the transform/append steps. And no nastygrams in the log files!
Much appreciated!
--Ben
As a followup, is there a way to disable SAS looking for field names on the first line of the spreadsheet in the "Libname Excel ..." approach? It picked up a title and none of the columns have reasonable data for fieldnames.
Thanks!
--Ben
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.