BookmarkSubscribeRSS Feed
lalohg
Quartz | Level 8

Hello there,

I have an Excel book and would like to import all sheets from SAS. All sheets have a common ID and Name of people but with different length. Does anyone know how to import all sheets that I need without importing each sheet at the time?

Also, When I tried to import only one sheet with columns having "hour at start" and "hour at end" of a specific surgical procedure I get years in SAS instead of hours. I have changed the format of these columns in Excel to "text", "general" and "time" but it didn't work

all your help will be appreciated

Thanks

Eduardo.

5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

1- You can only import one sheet a a time.

2- What exact values do you get? You are not getting years, you are getting numbers. What examples of these numbers can you provide?

lalohg
Quartz | Level 8

Thanks Chris,

You are right I don't get years I get dates 29DEC1899 or mostly 30DEC1899 for all entries.

Hour columns in Excel range from 0:00:00 to 23:59:00

ballardw
Super User

I believe that 30Dec1899 is how SAS receives an Excel date of 0 (which Excel in Microsoft,s infinite will display as January 0, 1900). Since the algorithm works for Excel 1/1/1900 (value of 1) then subtract one day from 1/1/1900 you get 12/30/1899. Except Excel doesn't really use dates prior to 1/1/1900.

Test this by typing a 0 into a cell in Excel then format as a date.

also Type a date prior to 1/1/1900 and then try to convert to a basic number.

anan
Calcite | Level 5

Hi @lalohg can you show us a sample data. and the output you want.

MadhuKorni
Quartz | Level 8

By using Libname we can bring all the spreadsheets in excel workbook to SAS environment in the form of datasets.

The spreadsheets names will be the Dataset names followed by $.

For example if Sample.xls is the workbook that consists of Acc, AccNums, CustIds as spreadsheets then if you use libname statement thenAcc$, AccNums$, CustIds$ will be the dataset names.

Libname Libref Excel "Path\Sample.xls";

Libref is a user defined name.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1193 views
  • 0 likes
  • 5 in conversation