From: Tom Abernathy on
I see two issues. The easy one is to put double quotes around the path
in your LIBNAME statement.
The second is access to the I and A1 to A... macro variables. If you
are really generating them with the SQL statement inside that macro
they will be defined as local to that macro and thus "disappear" when
the macro ends. You can test this by doing %put &path.

You can solve this by moving the libname statement into the macro or
adding a %GLOBAL statement to force the macro variables to be defined
in the global name space, or defining the macro variables before
calling the macro.

On Jan 7, 6:01 am, peesari.mah...(a)GMAIL.COM ("SUBSCRIBE SAS-L Joe H.
Smith") wrote:
> HI all,
>
> I want to use macro variable in libname statement.
>
> %let
> path=/sasconf/Dev/Lev1/SASMain/C/QUARTER/STF_TEST/&&a&i/Fcst_gp_spec
> _item_fac_lev3;
>
> libname test &path.;
>
> i am creating macro variable from below code...
>
> %macro mahesh;
> PROC SQL noprint;
> select new_group into :a1-:a200 from trans;
> select count(*) into :cnt from trans;
> /*drop table outmodelinfo;*/
> %do i = 1 %to &cnt;
> %PUT "&&a&i";
>
> %end;
> quit;
> %mend mahesh;
>
> above macro gets me values for &&a&i.
>
> i hope i am using macro variable wrongly in libname statement.
>
> Please help out.
>
> gives me folowing error,...
>
> WARNING: Apparent symbolic reference I not resolved.
> WARNING: Apparent symbolic reference A not resolved.
> WARNING: Apparent symbolic reference I not resolved.
> 14         %let
> path=/sasconf/BEMLDev/Lev1/SASMain/C/QUARTER/STF_TEST/&&a&i/Fcst_gp_
> spec_item_fac_lev3;
> ERROR: Libref in LIBNAME statement must be followed either by quoted string or
> engine name or semicolon; "/" found.
> ERROR: Error in the LIBNAME statement.
> WARNING: Apparent symbolic reference A not resolved.
> WARNING: Apparent symbolic reference I not resolved.

 | 
Pages: 1
Prev: perl regex :URGENT
Next: perl regex :URGENT