BookmarkSubscribeRSS Feed
steve_citi
Calcite | Level 5
I am running the following macro in SAS EG.

The SAS dataset created does NOT have underscores between column names containing 2 or more words. For example, Branch Number does NOT become Branch_Number, but stays Branch Number.



%macro import_xls(data=,sheet=,xls=);

proc import dbms=excelcs out=&data
datafile="&xls"
replace;
server="&machineid..nam.nsroot.net"; /* Name of PC files server */
port=8621; /* Port number listening on the PC server */
version='2002'; /* Excel file version */
sheet="&sheet"; /* Sheet name */
scantext=yes; /* Scan all rows data for the largest size */
usedate=yes; /* Use DATE format for date/time columns */
scantime=yes; /* Scan and identify time columns */
dbsaslabel=none; /* Leave SAS label names to be nulls */
textsize=512; /* Largest text size allowed */
run;

%mend import_xls;
2 REPLIES 2
twocanbazza
Quartz | Level 8
Have a look at the option "validvarname".
RichardH_sas
SAS Employee
In certain cases, EG will allow non-default column names to be created. As the other poster suggests, you might try submitting the following code, then calling your macro program:

OPTIONS VALIDVARNAME=V7;

The default setting in EG is VALIDVARNAME=ANY.

There's a note about GETNAMES=YES changing things over to SAS names... might be worth a test as well.

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#/documentation/cdl/en...

Tech support could also be a good resource on this: http://support.sas.com/techsup/contact/

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2556 views
  • 0 likes
  • 3 in conversation