BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
millice2
Calcite | Level 5

Screen Shot 2023-03-24 at 9.08.18 AM.pngScreen Shot 2023-03-24 at 9.08.51 AM.png

I keep having an error trying to import an Excel file as a SAS file using the codes above. What can I do to correct the error?  OR, Do you have a different code I can use?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
And the other corrections?

Code as text not images?

https://video.sas.com/detail/video/4664358166001/using-the-import-data-utility-in-sas-studio?autoSta...

proc import datafile = '/home/Afiba/Screen addiction.xlsx'
out = addiction
dbms = xlsx
replace
;
run;

View solution in original post

6 REPLIES 6
Reeza
Super User
Please post your code as text, it makes it easier to modify your code and show you the correct approach.

You need to provide the full file path for the code, for the datafile parameter. Right click on the Excel file, select properties and you'll find the file path there.

Change the DBMS to XLSX. I think some of the other parameters are also

Here's a video tutorial:

https://video.sas.com/detail/video/6295501319001/import-a-microsoft-excel-worksheet
millice2
Calcite | Level 5

Thank you for the response. It doesn't work the same for SAS Studio following the video. Can a version of SAS help me do the same as in the video?

Reeza
Super User
And the other corrections?

Code as text not images?

https://video.sas.com/detail/video/4664358166001/using-the-import-data-utility-in-sas-studio?autoSta...

proc import datafile = '/home/Afiba/Screen addiction.xlsx'
out = addiction
dbms = xlsx
replace
;
run;
millice2
Calcite | Level 5
What is SAS code for finding the difference in mean of a lifestyle between Group A and Group B adjusting for age and gender?

I used the code below but it didn't work?
proc glm data=mydata;
class group gender;
model lifestyle = group gender age / solution;
lsmeans group / adjust=bon;
run;
Reeza
Super User
Please post as a new question. And clarify what didn't work means. That could mean anything from you missed a semicolon, to using the wrong procedure, to your computer is stuck in an infinite loop and explodes.
millice2
Calcite | Level 5

Below is the code I used.

 

PROC IMPORT
DATAFILE="path_to_excel_file.xlsx"
OUT=SAS_dataset_name
DBMS=EXCEL REPLACE;
SHEET="worksheet_name";
GETNAMES=YES;
MIXED=YES;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 894 views
  • 0 likes
  • 2 in conversation