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

Hi all,

 

I'm very new to SAS and trying to import data from this excel file using the infile data step (i managed to import the data successfully using the import proc step) and can't seem to understand why its not working.

 

I am trying to display the dates and associated variable into SAS however every time i run this code, SAS generates a . for each observation.

 

I thought it was a formatting error and have tried multiple ways to read this information i can't figure it out, any help is appreciated 🙂

 

The code and outputs i entered are below, specifically the use of informat and format functions;

Also, only the first 33 of 123 observations are read,

 

Thank you.

Screen Shot 2018-11-22 at 4.26.00 pm.pngScreen Shot 2018-11-22 at 4.26.10 pm.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
singhsahab
Lapis Lazuli | Level 10

Hi Kalu,

 

Welcome !! You can use PROC Import procedure .like below. 

 

proc import datafile="\\path\data.xls"
out=want dbms=excel replace;
run;

proc print data=want;
format date ddmmyy8.;
run;

Thanks,

View solution in original post

6 REPLIES 6
Kalu93
Calcite | Level 5
Thank you for the clarification 🙂
singhsahab
Lapis Lazuli | Level 10

Hi Kalu,

 

Welcome !! You can use PROC Import procedure .like below. 

 

proc import datafile="\\path\data.xls"
out=want dbms=excel replace;
run;

proc print data=want;
format date ddmmyy8.;
run;

Thanks,

Reeza
Super User

To import an XLSX or XLS file you need to use PROC IMPORT. And unfortunately there isn't a way to specify what format/informat you want for the variables as you read them in. If you want to get around that you can convert the file to a csv and then write a data step to import the file. 

 


@Kalu93 wrote:

Hi all,

 

I'm very new to SAS and trying to import data from this excel file using the infile data step (i managed to import the data successfully using the import proc step) and can't seem to understand why its not working.

 

I am trying to display the dates and associated variable into SAS however every time i run this code, SAS generates a . for each observation.

 

I thought it was a formatting error and have tried multiple ways to read this information i can't figure it out, any help is appreciated 🙂

 

The code and outputs i entered are below, specifically the use of informat and format functions;

Also, only the first 33 of 123 observations are read,

 

Thank you.

Screen Shot 2018-11-22 at 4.26.00 pm.pngScreen Shot 2018-11-22 at 4.26.10 pm.png

 


 

Kalu93
Calcite | Level 5

Thank you for the clarification 🙂

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 16. 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
  • 1816 views
  • 1 like
  • 4 in conversation