|
I think the poster is relying on the %put to tell him/her if the macro
create in SQL worked but since he/she has no quit after the SQL statement
the %put was done before the macro variable was set by SQL.
This will work (under Jacks assumption that the hospital really exists.
proc sql;
select hospname into :hosp from ia.hospitals where hospid=&hospid;
quit ;
%put &hosp;
Don
On Thu, 1 Apr 2004 16:49:35 -0700, Jack Hamilton
<JackHamilton@FIRSTHEALTH.COM> wrote:
>Macro variables are stored as strings, but so are programs. The code
>below would translate to
>
> select hospname into :hosp from ia.hospitals where hospid=7673;
>
>which is valid code if hospid is numeric.
>
>Please post the relevant part of your job log so we can possibly see
>what error is actually happening.
>
>Are you sure that there's a hospital with HOSPID=7673 in your data
>set?
>
>
>
>
>--
>JackHamilton@FirstHealth.com
>Manager, Technical Development
>Metrics Department, First Health
>West Sacramento, California USA
>
>>>> vdesilva <vldesilva@CS.COM> 04/01/2004 3:33 PM >>>
>%let hospid = 7673;
>
>
>proc sql;
>select hospname into :hosp from ia.hospitals where hospid=&hospid;
>%put &hosp;
>
>I have the above code, hospid is a numeric coulmn in the data set.
>Since macro variables are stored as string the Where clause doesn't
>work. How can I convert the macro variable to numric and make the PROC
>SQL work for me. Thanks.
|