DATA Step, Macro, Functions and more

file name with a dash in SAS macro

Reply
Occasional Contributor
Posts: 8

file name with a dash in SAS macro

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

Trusted Advisor
Posts: 1,631

Re: file name with a dash in SAS macro

Use

 

PROC SQL DQUOTE=ANSI;

New User
Posts: 1

Re: file name with a dash in SAS macro

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

How did you solve the problem?

 

Thanks in advance!

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