SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
surajmetha55
Fluorite | Level 6

Dear all,

             I am trying to import Excel file using 2 different program and also tried using SAS import wizard but non of them help me out :   

Program 1:

 

proc import datafile="W:\auto\Trial.xlsx"
		out = T dbms = xlsx ;
		sheet="TI";
		getnames=yes;	
run;

gives all observation but warning message in log :

 

WARNING: Some character data was lost during transcoding in column: IETEST at obs 3.

 

Program 2:

 

libname sur pcfiles path="W:\auto\Trial.xlsx" ;

data ag;
	set sur.'Ti$'n;
  run;

Both of the program are not able to read "β" (Beta-symbol) and superscript number come to base.

 

Can you please help me to deal with importing "xlsx" without changing special character.  

 

Sample excel data

 

 

5 REPLIES 5
tomrvincent
Rhodochrosite | Level 12
Try 'getnames=no' to see if the data will come in at all. I often do this to bring data in as text that I can then manipulate more freely.
surajmetha55
Fluorite | Level 6

Thank you for replay. Trying 'getnames=no' just changed Variable name. Do you bring data text manually or programaticaly, if yes can you share program or give some hint.

 

Even I tried using SAS import wizard but it is also not helping me out.

tomrvincent
Rhodochrosite | Level 12
Yes, it does, but you can rename the variables based on whatever row you have the column names in. Also, since they all come in as text, you can test whether they successfully convert to numbers or dates.
DWilson
Pyrite | Level 9

@surajmetha55 wrote:

Dear all,

             I am trying to import Excel file using 2 different program and also tried using SAS import wizard but non of them help me out :   

Program 1:

 

proc import datafile="W:\auto\Trial.xlsx"
		out = T dbms = xlsx ;
		sheet="TI";
		getnames=yes;	
run;

gives all observation but warning message in log :

 

WARNING: Some character data was lost during transcoding in column: IETEST at obs 3.

 

Program 2:

 

libname sur pcfiles path="W:\auto\Trial.xlsx" ;

data ag;
	set sur.'Ti$'n;
  run;

Both of the program are not able to read "β" (Beta-symbol) and superscript number come to base.

 

Can you please help me to deal with importing "xlsx" without changing special character.  

 

Sample excel data

 

 


You might try changing your SAS session encoding to UTF-8. If your SAS session encoding is already UTF-8 then I'm not sure why you are having the issue unless proc import is somehow treating the file as having Latin encoding.

 

 

 

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 7037 views
  • 0 likes
  • 3 in conversation