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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

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