BookmarkSubscribeRSS Feed
sam369
Obsidian | Level 7

Hi All,

 

how to import the excel, using porc import . having some values have apostrophes in the columns!!!

 

excel coulumns   :

 

 sub     txt

 100     medical's

100      software's

 

Mycode:

proc import out=want datafiles="location.xlsx"

                  dbms=xlsx replace;

                 getnames='yes';

run;

 

Thanks

Sam

 

 

2 REPLIES 2
SASKiwi
PROC Star

Try: options validvarname = v7 if you want to convert your columns to the SAS naming convention.

 

If you want to leave the column names as is use validvarname = any. If you do this any later reference to column names will need to be like this: 'Excel Column Name'n and not simple the name. 

Tom
Super User Tom
Super User

Apostrophes like in your example data should be read as part of the character variables value. What type of problem are you having?

The only problem I see is that you do not want the quotes around the yes in the GETNAMES=yes ; statement part of the PROC IMPORT procedure call.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 2 replies
  • 629 views
  • 0 likes
  • 3 in conversation