Date: Wed, 11 Jun 2008 19:21:50 -0400
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ya Huang <ya.huang@AMYLIN.COM>
Subject: Re: AN OUTPUT (COSMETIC ISSUE) QUESTION
Content-Type: text/plain; charset=ISO-8859-1
I really doubt the original is a dataset. It looks more like
a report to me. Anyway, assuming it is a dataset, also assuming the var
"number" is populated for all the rows, here is an old trick:
data xx;
input num pos $;
cards;
10001 LOCAL
10001 BANK
10001 SANK
10001 MANK
10001 PANK
1002 SKIN
1002 WHITE
1002 BLUE
1002 GREEN
1002 BLACK
1003 FOOD
1003 JAM
1003 JELLY
1003 MANGO
1003 ORANGE
;
data xx;
set xx;
by num notsorted;
if first.num then n_=0;
else do; n_+1; pos='A0'x||pos; end;
run;
proc report nowd;
column num n_ pos;
define num / display order order=data;
define n_ / order noprint;
define pos / display;
run;
num pos
10001 LOCAL
  BANK
  SANK
  MANK
  PANK
1002 SKIN
  WHITE
  BLUE
  GREEN
  BLACK
1003 FOOD
  JAM
  JELLY
  MANGO
  ORANGE
On Wed, 11 Jun 2008 18:25:11 -0400, Tom Smith <need_sas_help@YAHOO.COM>
wrote:
>I have a following dataset with two variables:
>
>Number Postion
>-----------------------
>10001 LOCAL
> BANK
> SANK
> MANK
> PANK
>1002 SKIN
> WHITE
> BLUE
> GREEN
> BLACK
>1003 FOOD
> JAM
> JELLY
> MANGO
> ORANGE
>
>I need a proc report output (or to create a dataset)
>where the output looks like as below means the first
>value of the variable position for each number
>should be in far left.
>
>
>Number Postion
>------------------
>10001 LOCAL
> BANK
> SANK
> MANK
> PANK
>1002 SKIN
> WHITE
> BLUE
> GREEN
> BLACK
>1003 FOOD
> JAM
> JELLY
> MANGO
> ORANGE
>
>Thanks. It might be 1-2-3 for you but I could not do it.
>Thanks for helping this poor guy.