Date: Wed, 10 Feb 2010 15:11:14 -0500
Reply-To: Nathaniel Wooding <nathaniel.wooding@DOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nathaniel Wooding <nathaniel.wooding@DOM.COM>
Subject: Re: Data Manipulation
In-Reply-To: <755e7da4-bb98-4e80-8da3-ef6f815099dd@21g2000yqj.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
SD
It should. I set the length of SKU1 to 10 so your new pieces such as E2345 will fit with room to spare. The Scan function does not care about how long the substrings are.
Nat
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of SD
Sent: Wednesday, February 10, 2010 2:11 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Data Manipulation
Thanks Nathan, Oleg, if I now replace SKU - a/b/c/d by E2345/E2346/
E2347, will it give the same results ?
thanks SD
On Feb 10, 7:25 pm, nathaniel.wood...@DOM.COM (Nathaniel Wooding)
wrote:
> Here is a modification of Oleg's code that uses the V9 Count function which in this case tells us how many slashes appear in a particular SKU value.
>
> Nat wooding
>
> data tt (rename = ( Sku1 = Sku ));
> infile cards;
> length sku1 $ 10;
> input year country $ SKU $ original countft;
> Value = count(sku , '/' ) + 1 ;
> Original = Original / value;
> Countft = Countft / Value;
> do i=1 to value;
> sku1=scan(sku,i,'/');
> output;
> end;
> drop i value sku ;
> cards;
> 2009 germany a/b/c/d 40 20
> 2009 uk f/g/h 30 6
> ;
>
>
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of SD
> Sent: Wednesday, February 10, 2010 5:49 AM
> To: SA...@LISTSERV.UGA.EDU
> Subject: Data Manipulation
>
> Hi everyone,
>
> i have a dataset
> year country SKU original countft
> 2009 germany a/b/c/d 40 20
> 2009 uk f/g/h 30 6
>
> Want a dataset
> year country SKU original countft
> 2009 germany a 10 5
> 2009 germany b 10 5
> 2009 germany c 10 5
> 2009 germany d 10 5
> 2009 uk f 10 2
> 2009 uk g 10 2
> 2009 uk h 10 2
>
> Need to scan , extract the SKUs -which I have been able to do,
> however getting the number of SKU and dividing the number, that the
> area , I digging.
>
> As you can see the numbers are divided by the count of SKUs in the SKU
> column for Germany there are 4 skus and for UK there are 3, the values
> of original and countft gets divided by 4 and 3 respectively.
>
> Any help appreciated.
>
> thanks
> SD
> CONFIDENTIALITY NOTICE: This electronic message contains
> information which may be legally confidential and or privileged and
> does not in any case represent a firm ENERGY COMMODITY bid or offer
> relating thereto which binds the sender without an additional
> express written confirmation to that effect. The information is
> intended solely for the individual or entity named above and access
> by anyone else is unauthorized. If you are not the intended
> recipient, any disclosure, copying, distribution, or use of the
> contents of this information is prohibited and may be unlawful. If
> you have received this electronic transmission in error, please
> reply immediately to the sender that you have received the message
> in error, and delete it. Thank you.- Hide quoted text -
>
> - Show quoted text -
|