| Date: | Tue, 31 Jul 2007 17:36:51 -0400 |
| Reply-To: | souga soga <souga1234@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | souga soga <souga1234@GMAIL.COM> |
| Subject: | Re: SQL |
|
| In-Reply-To: | <8AD8F86B3312F24CB432CEDDA71889F203EF7AF0@ex06.GHCMASTER.GHC.ORG> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
Thanks for your solutions, but for sheer curiousity i would like to know
whether something like this is
doable in SQL.
On 7/31/07, Pardee, Roy <pardee.r@ghc.org> wrote:
>
> Can you explain the SQL requirement? This is such a natural for
> datastep... Something like:
>
> Data want ;
> set have ;
> by var1 var2 ;
> MyKey + first.var2 ;
> Run ;
>
> Would do it I think...
>
> Cheers,
>
> -Roy
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> souga soga
> Sent: Tuesday, July 31, 2007 1:01 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: SQL
>
> Hi,
>
> I have a data set :
>
> Var1 Var2
> A 2
> A 1
> B 2
> B 2
> C 5
> D 1
> R 7
> R 7
>
> I would like to the output to look like this:
>
> MyKey Var1 Var2
> 1 A 2
> 2 A 1
> 3 B 2
> 3 B 2
> 4 C 5
> 5 D 1
> 6 R 7
> 6 R 7
>
> i.e i would like to create a counter (MyKey variable) which identifies
> the uniques and duplicates in this manner.
> I need this to be done using PROC SQL .
>
>
> Thanks,
> Sa
>
|