BookmarkSubscribeRSS Feed
Manvel
Obsidian | Level 7

Hello!

 

I am using Proc Import for importing Excel csv file, I have situation when the excel file collected in different way and SAS log is showing issues when I am just using this code(below). I tried to use "Infile" but again the same issues are showed.

 

Example from excel file:

Manvel_0-1700749349825.png

Proc Import File = "filelocation"
    Out = test
    Dbms = csv
    replace;
Run;

*Infile code;
  Infile "filelocation"
  delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2;										
  Informat STUDYID $15. SITENUM BEST32. SUBNUM BEST32. VISIT $35. XXDT date11. XXTIM TIME20.3;
  Format   STUDYID $15. SITENUM BEST12. SUBNUM BEST12. VISIT $35. XXDT date11. XXTIM TIME20.3;
  Input STUDYID $ SITENUM $ SUBNUM $ VISIT $ XXDT XXTIM;										
run;
4 REPLIES 4
PaigeMiller
Diamond | Level 26

... and SAS log is showing issues ...

 

What issues? Show us the LOG for this PROC IMPORT (all of it, every single line in the log for this PROC IMPORT).

--
Paige Miller
Manvel
Obsidian | Level 7

Manvel_0-1700750461364.png

I masked not necessary variable names and paths.

 

LinusH
Tourmaline | Level 20

So this log is for a data step import?

Clearly your code does bot align with your data, and without an infile, it's hard to tell what your are doing wrong.

Also, your example of input data does not match your input code.

Can you ellaborate around "...when the excel file collected in different way"?

Data never sleeps
Tom
Super User Tom
Super User

Do you have an EXCEL file?  Like in your photograph?  If it is an EXCEL file (like an XLSX file) then you will have to use PROC IMPORT to read it.

 

Or do you have a TEXT FILE? Like in your code? In that case DO NOT let EXCEL open it automatically.   And if you do accidental do open it that way DO NOT SAVE it.  EXCEL will change the values.  If you have already done this then try to go back to the original file you received before you opened it with EXCEL.

 

If you have a TEXT file then share a few sample lines of the file and we can advise on what INFORMAT to use the read the values. 

 

Hint: Don't use BEST as an INFORMAT.  It is the name of a FORMAT and using it as the name of an INFORMAT will just be confusing since there is no "best" way to store a number.  SAS stores all numbers as 64 bit binary floating point values.

 

 

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 808 views
  • 0 likes
  • 4 in conversation