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 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: Richard.M.Walker@BRITISHAIRWAYS.COM
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


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