Date: Fri, 28 Apr 2000 10:01:19 EDT
Reply-To: Bernard Tremblay <imaginasys@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Bernard Tremblay <imaginasys@HOTMAIL.COM>
Subject: Re: selecting values into a set of macro variables where the
number of distinct values is unknown
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Hi Richard,
Try the following SQL:
proc sql stimer;
select distinct var into : mlist separated by ','
from lib.sasfile
;
%let n = &sqlobs;
quit;
You will have the list of "&n" distinct values of variable "var" into
the macro "mlist". They will all be separated by a comma. You only have to
parse them with a macro if you want the list into different macro
variables.
Hope it helps,
Bernard Tremblay
Imaginasys enr.
imaginasys@hotmail.com
B: Bernard.Tremblay@csst.qc.ca (418)528-9113
R: bertrem@quebectel.com (418)658-1411
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>From: "Walker, Richard M" <Richard.M.Walker@BRITISHAIRWAYS.COM>
>Reply-To: "Walker, Richard M" <Richard.M.Walker@BRITISHAIRWAYS.COM>
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: selecting values into a set of macro variables where the number
> of distinct values is unknown
>Date: Fri, 28 Apr 2000 13:11:15 Z
>
>---------------------- Forwarded by Richard M Walker/HEATHROW/BRITISH
>AIRWAYS/GB on 28/04/2000 14:08 ---------------------------
>
> Richard M Walker
> 28/04/2000 12:25:42
>
>
>Tel: 0208-56-28248
>Mobile: 0385-934634
>OceanWave SAS Developer
>TBC 10 South Wing Bay 4B - S120
>
>To: sas-l
>cc:
>bcc:
>Subject: selecting values into a set of macro variables where the number of
>distinct values is unknown
>
>Help,
>
>I recall seeing an e-mail sometime ago that indicated that using proc sql
>it is possible to select all the distinct values of a column into a set of
>macro variables.
>
>Can anyone show me an example of this technique?
>
>Regards
>Richard
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
|