BookmarkSubscribeRSS Feed
bunnycao
Calcite | Level 5

Hi guys,

i'm trying to import several tables from external Access database into SAS. the access files names are like 'A2014' , 'A2015', and the tables in each file have names 'A2014-01' , 'A2014-02' ...

my code is 

%macro loadin(year=, month=) ;

  libname temp PCFILES path="C:\trial\A&year..accdb";

  proc sql;

  select a ,  b,  c

   from temp."A&year.-&month"n ;

quit;

%mend;

%loadin (year=2014, month=01) ;

 

so i succeeded in assigning the libname, linking the external access file with SAS. but in the proc sql step, error msg showed up , saying A2014-01 is not a valid SAS name. how do I edit my code to get around problem ?? 

 

Thanks,

Darren

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Use

 

PROC SQL DQUOTE=ANSI;

--
Paige Miller
SummerLee
Calcite | Level 5

Hi I got the same problem of dash in SAS macro too. 

How did you solve the problem?

 

Thanks in advance!

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