Date: Wed, 30 Oct 2002 10:27:22 -0500
Reply-To: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject: Re: into: seperated by syntax
Content-Type: text/plain
> From: Goldman, Brad (AT-Atlanta) [mailto:Brad.Goldman@AUTOTRADER.COM]
> Consider the following from the SAS online docs:
> proc sql;
> select distinct quote(style)
> into :types separated by ', '
> from sasuser.houses;
>
> Anyone know if there is a way to prepend/append the &types
> macro variable created within this SQL step? For example, I
> might want the final string not to be CONDO, RANCH, SPLIT,
> TWOSTORY, but Houselist: 'CONDO, RANCH, SPLIT, TWOSTORY done'
> I can't find any reference to it... but sometimes docs do
> not tell all.
you can add pre- or ap-pend text to each value you're selecting
select 'prepend text' !! distinct quote(style)
'append text'
> proc sql;
> select distinct quote(style)
> into :types separated by ', '
> from sasuser.houses;
;quit;
%LET TYPES = Houselist: &TYPES. done;
Will this not do what you want?
> If there is a not a way, does anyone agree with me that it
> would be nice to have? For example, you could say:
>
> proc sql;
> select distinct quote(style)
> into :types separated by ', ' beginning with
> "Houselist: '" ending with " done'"
> from sasuser.houses;
%let the macro language do what it does well;
%let's not mess with SQL syntax
Ron Fehd the SQL into:macro maven CDC Atlanta GA USA RJF2@cdc.gov
By using your intelligence
you can sometimes make your problems twice as complicated.
-- Ashleigh Brilliant
|