DATA Step, Macro, Functions and more

How to create a sas dataset using excel table name with space

Accepted Solution Solved
Reply
Contributor
Posts: 55
Accepted Solution

How to create a sas dataset using excel table name with space

I need to create a SAS dataset using  excel table name with space. I have tried below which is not working.

libname xlsFile XLSX "/user/path/file.xlsm";
options validvarname=v7;


PROC SQL;
    create table work.excel_table as 
	(select * from xlsFile.'first Sheet$'n);
 quit;

Accepted Solutions
Solution
‎09-04-2016 01:35 PM
Super User
Posts: 19,878

Re: How to create a sas dataset using excel table name with space

Posted in reply to jayakumarmm

Using the N literal notation is the correct method. 'Sheet Name$'n

As mentions post your log. Note that it is case sensitive so needs to match Excel exactly. 

Please post a pic of library with sheet names as well. 

 

View solution in original post


All Replies
Respected Advisor
Posts: 3,156

Re: How to create a sas dataset using excel table name with space

Posted in reply to jayakumarmm
options validvarname=any;
Contributor
Posts: 55

Re: How to create a sas dataset using excel table name with space

I am still getting error.i.e. not to identify the Sheet name due to space issue.

My actual issue with Excel sheet name with space. 

Respected Advisor
Posts: 3,156

Re: How to create a sas dataset using excel table name with space

Posted in reply to jayakumarmm

log please?

Contributor
Posts: 55

Re: How to create a sas dataset using excel table name with space

Thank you so much for helping me. I have fixed this issue by adding single quotes to my sheet name. .i.e. 'first sheet'n

Super User
Posts: 19,878

Re: How to create a sas dataset using excel table name with space

Posted in reply to jayakumarmm

Using the N literal notation is the correct method. 'Sheet Name$'n

As mentions post your log. Note that it is case sensitive so needs to match Excel exactly. 

Please post a pic of library with sheet names as well. 

 

Solution
‎09-04-2016 01:35 PM
Super User
Posts: 19,878

Re: How to create a sas dataset using excel table name with space

Posted in reply to jayakumarmm

Using the N literal notation is the correct method. 'Sheet Name$'n

As mentions post your log. Note that it is case sensitive so needs to match Excel exactly. 

Please post a pic of library with sheet names as well. 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 485 views
  • 0 likes
  • 3 in conversation