Date: Wed, 28 May 2008 09:53:29 -0700
Reply-To: Nanita <susana.urbano@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nanita <susana.urbano@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: Missing Value
Content-Type: text/plain; charset=ISO-8859-1
On 27 Maio, 18:50, Mterje...@RUSSELL.COM ("Terjeson, Mark") wrote:
> Hi Nanita,
>
> Here is one approach, using first.
> last. flags to affect only filler
> within CODTIT groups, and LAG()
> contains the previous record values
> if the logic decides to use them.
>
> data sample;
> input CODTIT VALUE DATE $10.;
> cards;
> 100019900833 95.764 21-04-2008
> 100019900833 96.256 22-04-2008
> 100019900833 96.366 24-04-2008
> 100019900833 95.562 25-04-2008
> ;
> run;
>
> proc sort data=sample;
> by CODTIT DATE;
> run;
>
> data result(drop=hold_: prev_:);
> set sample;
> by CODTIT DATE;
> prev_value = lag(value);
> prev_date = lag(date);
> if not first.CODTIT then
> do;
> if input(prev_date,ddmmyy10.)+1
> ne input(date,ddmmyy10.) then
> do;
> hold_value = value;
> hold_date = date;
> value = prev_value;
> date = put(input(prev_date,ddmmyy10.)+1,ddmmyyd10.);
> output;
> value = hold_value;
> date = hold_date;
> end;
> end;
> output;
> run;
>
> Hope this is helpful.
>
> Mark Terjeson
> Senior Programmer Analyst
> Investment Management & Research
> Russell Investments
>
> Russell Investments
> Global Leaders in Multi-Manager Investing
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SA...@LISTSERV.UGA.EDU] On Behalf Of
>
> Nanita
> Sent: Tuesday, May 27, 2008 10:22 AM
> To: SA...@LISTSERV.UGA.EDU
> Subject: Missing Value
>
> Hello there,
>
> I have some data that have missing values.
>
> For the days that the data are missing, it should create a row with
> the same data that the day before.
>
> CODTIT VALUE DATE
>
> 100019900833 95.764 21-04-2008
> 100019900833 96.256 22-04-2008
> 100019900833 96.366 24-04-2008
> 100019900833 95.562 25-04-2008
>
> For example there's no data for 23-04-2008.
>
> And the new table should have a row for 23-04-2008 (with the same
> Value as in 22-04-2008) just like this:
>
> 100019900833 96.256 23-04-2008
>
> Can you guys help me?
I did this way but...
15 data desenalm.result(drop=hold_: prev_:);
16 set DESENALM.FUTUROS_WD_ALERT;
17 by TICKER DATA2;
18 FORMAT DATA2 DDMMYY10.;
19 prev_value = lag(valor);
20 prev_date = lag(data2);
21 if not first.ticker
22 then
23 do;
24 if (input(prev_date,ddmmyy10.)+1
25 AND input(datA2,ddmmyy10.)) then
26 do;
27 hold_value = valor;
28 hold_date = data2;
29 valor = prev_value;
30 data2 =
put(input(prev_date,ddmmyy10.)+1,ddmmyyd10.);
31 output;
32 valor = hold_value;
33 data2 = hold_date;
34 end;
35 end;
36 output;
37 run;
NOTE: Numeric values have been converted to character values at the
places
given by: (Line):(Column).
24:22 25:22 30:38
NOTE: Character values have been converted to numeric values at the
places
given by: (Line):(Column).
30:28
NOTE: Invalid argument to function INPUT at line 24 column 16.
|