DATA Step, Macro, Functions and more

import columns

Reply
Regular Contributor
Posts: 168

import columns

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

 

 

Super User
Posts: 3,250

Re: import columns

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. 

Super User
Super User
Posts: 7,039

Re: import columns

[ Edited ]

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.

Ask a Question
Discussion stats
  • 2 replies
  • 142 views
  • 0 likes
  • 3 in conversation