LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 1 Apr 2004 18:58:23 -0500
Reply-To:   Don Stanley <don_stanley@PARADISE.NET.NZ>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Don Stanley <don_stanley@PARADISE.NET.NZ>
Subject:   Re: using Macro variables within proc sql

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.


Back to: Top of message | Previous page | Main SAS-L page