I used the following procedure to create a library using xlsx engine. there are twenty worksheets in the excel file. But in proc contents I am not able to see why?
libname xyz xlsx 'C:\Users\Mallik\Desktop\94basepe\input\SDTM_METADATA.xlsx';
run;
proc contents data =xyz._all_ ;
run;
proc datasets lib=xyz;
quit;
Log:
libname xyz xlsxl'C:\Users\Mallik\Desktop\94basepe\input\SDTM_METADATA.xlsx';
NOTE: Libref XYZ was successfully assigned as follows:
Engine: EXCEL
Physical Name: C:\Users\Mallik\Desktop\94basepe\input\SDTM_METADATA.xlsx
19626 run;
when I use proc contents or proc datasets I am only able to see the following without the list of the sheets in the workbook. The library when verified by opening also had no files. Why did this happen???
Since LIBNAME XLSX can be used to create a spreadsheet file, success of the LIBNAME statement does not mean the file is actually there; if it's not there, it would be created with the first write operation to it.
Run this:
libname xyz xlsx 'C:\Users\Mallik\Desktop\94basepe\input\SDTM_METADATA.xlsx';
data xyz.class;
set sashelp.class;
run;
and look at the log.
BTW LIBNAME is a global statement, which is executed immediately and needs no RUN.
Please post the log from the code I gave you.
@Uma_Devi - Based on some earlier conversations, I think you sometimes use On Demand for Academics. Are you using On Demand for Academics for this code?
If using a locally installed version of SAS and accessing local files, then you should be OK. But following up on the point made by @Kurt_Bremser , The LIBNAME statement is going to work even if the argument for the Excel file location is wrong. Here is the example of me running your code on my computer:
Obviously I don't have your file nor your folder structure, but notice my LIBNAME statement does not produce an error. As expected, nothing is displayed in the PROC CONTENTS. I suggest that there is something wrong (such as a typo or the file doesn't exist) with the 'C:\Users\Mallik\Desktop\94basepe\input\SDTM_METADATA.xlsx' argument in your code.
This is a knowledge-sharing community for SAS Certified Professionals and anyone who wants to learn more about becoming SAS Certified. Ask questions and get answers fast. Share with others who are interested in certification and who are studying for certifications.To get the most from your community experience, use these getting-started resources:
Community Do's and Don'ts
How to add SAS syntax to your post
How to get fast, helpful answers