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

Hi all,

I'm imported an XLSx file into SAS University edition. For some reason three of the numeric variables have been classified by SAS as character variables, even though no observations include any characters. Can anyone tell me how to correct this?

Here is my import code:

 

PROC IMPORT DATAFILE="/folders/myfolders/Med.xlsx"
OUT=WORK.med2
DBMS=XLSX
REPLACE;

 

TIA for any help!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Check the type in the Excel file. There isn't really a good way to control the import from an Excel file, the usual workaround suggestions are to create a CSV file instead and import that, it allows you to have full control. It's really rare to have a full column of just numbers be imported as characters though. How is missing denoted in that file?

View solution in original post

4 REPLIES 4
Reeza
Super User
Check the type in the Excel file. There isn't really a good way to control the import from an Excel file, the usual workaround suggestions are to create a CSV file instead and import that, it allows you to have full control. It's really rare to have a full column of just numbers be imported as characters though. How is missing denoted in that file?
amigapomba
Fluorite | Level 6

Hi thanks very much for your help-

I looked closer at the entries for those variables in excel and saw that they each have one or two that were somehow entered as text. I will try to change them to numbers and repeat the import. Missing data in the Excel file are blank cells, for those three variables as well as for the seven other variables that sas correctly labeled as numeric.

amigapomba
Fluorite | Level 6

thanks again! after i corrected those cells the import worked and all numeric variables were classified as numeric.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1746 views
  • 2 likes
  • 3 in conversation