Date: Tue, 31 Aug 2004 16:49:10 -0400
Reply-To: Vladimir Grechko <vlad.grechko@MAIL.RU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Vladimir Grechko <vlad.grechko@MAIL.RU>
Subject: Re: Help with input (again, sorry!)
Thank you Ira, it works:
>Actually, the fact that the cells are merged doesn't matter,
>the rest is done with RETAIN:
>
> data your_dset (drop=_:);
> retain name quarter;
> infile your_dat dlm='09'x notab dsd missover;
> input _name :$32. _quarter month sales;
> if _name ne ' ' then name=_name;
> if _quarter ne . then quarter=_quarter;
> run;
>
> ... untested, but i'm pretty sure...
>
> Ira
On Tue, 31 Aug 2004 15:09:26 -0400, Vladimir Grechko <vlad.grechko@MAIL.RU>
wrote:
>Hi All,
>
>I apologize for the question that had undoubtedly been asked, and answered.
>Unfortunately, I cannot formulate the query for the search engine to get
>the answer I need.
>
>How can I read the following data from Excel into the dataset and have the
>name and the quarter for all observations (pls, see the req'd dset
>structure at the bottom)?
>
>In these data, all 12 cells for "Boddorf" are merged, so that it is always
>shows cell R2C1, and so are each 3 cells for the quarter (e.g., it's always
>R2C2 for Boddorf.quarter(1))
>
>Thanks in advance for your help,
>Vlad
>
>Name Quarter Month Sales
>Boddorf 1 1 1000
> 2 1200
> 3 1300
> 2 4 1467
> 5 1617
> 6 1767
> 3 7 1917
> 8 2067
> 9 2217
> 4 10 2367
> 11 2517
> 12 2667
>Isley 1 1 5000
> 2 5100
> 3 5200
> 2 4 5300
> 5 5400
> 6 5500
> 3 7 5600
> 8 5700
> 9 5800
> 4 10 5900
> 11 6000
> 12 6100
>
>This is what I need:
>
>Name Quarter Month Sales
>Boddorf 1 1 1000
>Boddorf 1 2 1200
>Boddorf 1 3 1300
>Boddorf 2 4 1467
>Boddorf 2 5 1617
>Boddorf 2 6 1767
>Boddorf 3 7 1917
>Boddorf 3 8 2067
>Boddorf 3 9 2217
>Boddorf 4 10 2367
>Boddorf 4 11 2517
>Boddorf 4 12 2667
>Isley 1 1 5000
>Isley 1 2 5100
>Isley 1 3 5200
>Isley 2 4 5300
>Isley 2 5 5400
>Isley 2 6 5500
>Isley 3 7 5600
>Isley 3 8 5700
>Isley 3 9 5800
>Isley 4 10 5900
>Isley 4 11 6000
>Isley 4 12 6100
|