Date: Mon, 22 Sep 1997 10:39:00 -0400
Reply-To: Dave_Mabey_at_RDA8POSTOFFICE1%RDCCMAIL%READERSDIGEST@READERSDIGEST.COM
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Dave_Mabey_at_RDA8POSTOFFICE1%RDCCMAIL%READERSDIGEST@READERSDIGEST.COM
Subject: Re: Macro and SQL(?) Question
Content-type: text/plain; charset=US-ASCII
Dave Mabey at RDA8POSTOFFICE1 @ RDCCMAIL
09/22/97 10:39 AM
New Text Item: Macro and SQL(?) Question
proc sql noprint;
select distinct(x)
into :v - :v99999_
from your.dataset;
Note: This code will sort the values so that &v1=a, &v2=b, &v3=c, etc.
If that is not acceptable, you will need to force the desired order with
an Order By statement. The system will build only as many macro variables
as there are distinct values; *not* 99999 of them.
______________________________ Reply Separator
_________________________________
Subject: Macro and SQL(?) Question
Author: canfdd@MTL.SAS.COM@INTERNET at RDNOTES
Date: 9/22/97 12:54 PM
(Embedded image moved to file: PIC001.PCX)
I would like to create a macro variable for each distinct values of a
classification variable (I think this can be done with proc sql and would
like to know how).
DETAILS:
I have a classification variable X (could be numeric or character) with an
unknown number of k classes.
I want to create k macro variables V1, V2, ..., Vk taking the distinct
values of the variable X.
EXAMPLE:
X
-----
a
c
a
b
c
==> V1=a V2=c V3=b (3 macro variables)
Thank you for your help !!
Francois
SMTPOriginator: owner-sas-l@UGA.CC.UGA.EDU