Date: Wed, 14 Nov 2007 12:01:07 -0500
Reply-To: Nirmal kumar <lazybone2k@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nirmal kumar <lazybone2k@GMAIL.COM>
Subject: Re: Missing values....
In-Reply-To: <01a801c826df$1b1172f0$c12fa8c0@HP82083701405>
Content-Type: text/plain; charset=ISO-8859-1
Hi SAS - Listers,
I have already done this by using a lot of if ...else.. statements and by
creating a new variables and freq counts, nmiss() and a custom macro...but
it takes about 25 mins to do this for 2 million records.......I thought i
will get some better idea from you guys(wrt proc SQL, or some other
procs....)......Thanks a lot for the support....
Please note that i am not bumping my work on you guys......i am just trying
to get a different approach for to solve any given problem....you guys are
great......
Thanks for the suggestions and tips....Keep rocking....
cheers,
Lazybone2k
On 11/14/07, Mary <mlhoward@avalon.net> wrote:
>
> I'm not quite sure what you want to do; if you just want the frequencies
> of the number of missing you could start with the original data and then
> create a new variable that has the count of the missing for each, then do a
> frequency of that new variable, like this:
>
> * *
>
> data outset;
>
> set inset;
>
> array missing_array{3} m1var--m3var;
>
> missing_count=*0*;
>
> do i=*1* to 3;
>
> if missing_array[i]=*.* then missing_count=missing_count + *1*;
>
> end;
> *
>
> run
> *;
>
> proc freq data=outset;
>
> tables missing_count;
>
> run;
>
> ----- Original Message -----
> *From:* Nirmal kumar <lazybone2k@GMAIL.COM>
> *To:* SAS-L@LISTSERV.UGA.EDU
> *Sent:* Wednesday, November 14, 2007 10:38 AM
> *Subject:* Re: Missing values....
>
>
> Hi Mary,
>
> Thanks for your suggestion...but that is not what i want to do.....if you
> look at the output that i want.
>
> Variable_name 1month 2motnh 3month
> Var 2 2 1
>
> The sample i gave in the forum is for one variable - var and it contains
> the
> values for the last 3 months(M1var - M3var)
>
> Id M1var M2var M3var
> 1 . . .
> 2 18 12
> 3 . . 11
> 4 4 3 9
> 5 3 1 2
>
> What i want to do is count the number of missig values wrt to time. How
> many
> observatons have missing values in the first month. How many observations
> have missing values in both first and second month? How many missign
> values
> in the first, second, third months?
>
> i dont want individual missing counts....i want somethign tied up with the
> time......Thanks a lot for your help...
>
> Cheers,
> Lazybone
>
>
>
> On 11/14/07, Mary <mlhoward@avalon.net> wrote:
> >
> > Hi,
> >
> > You could transpose the data and then do a count across, like this:
> >
> > *
> >
> > data
> > *inset;
> >
> > infile cards missover;
> >
> > input
> >
> > Id M1var M2var M3var;
> >
> > cards
> > ;
> >
> > 1 . . .
> >
> > 2 18 . 12
> >
> > 3 . . 11
> >
> > 4 4 3 9
> >
> > 5 3 1 2
> >
> > ;
> > *
> >
> > run
> > *;
> >
> >
> > *
> >
> > proc
> > **transpose* data=inset out=outset1(rename=(col1-col5=m1-m5));;*
> >
> > run
> > *;*
> >
> > data
> > *outset2;
> >
> > set outset1;
> >
> > array missing_array{*5*} m1--m5;
> >
> > missing_count=
> > *0*;
> >
> > do i=*1* to *5*;
> >
> > if missing_array[i]=*.* then missing_count=missing_count + *1*;
> >
> > end;*
> >
> > run
> > *;
> >
> >
> >
> > -Mary
> >
> > ----- Original Message -----
> > *From:* SAS-L Nirmal <lazybone2k@GMAIL.COM>
> > *To:* SAS-L@LISTSERV.UGA.EDU
> > *Sent:* Wednesday, November 14, 2007 10:04 AM
> > *Subject:* Missing values....
> >
> >
> > Dear SAS-Listers,
> >
> > I have a dataset with me which contains the values of a list of
> variables
> > for the past 6 months. I want to do a analysis on the null values of
> these
> > variables. The following is the sample dataset.
> > Id M1var M2var M3var
> > 1 . . .
> > 2 18 12
> > 3 . . 11
> > 4 4 3 9
> > 5 3 1 2
> >
> > M1value, M2value, M3value are the various values of a variable "var" in
> > the last 3 months. I want to get the %of missing values for this dataset
> > or somthing like this.
> >
> > Variable_name 1month 2motnh 3month
> > Var 2 2 1
> >
> > In short i want to find out how many observations have missing values in
> > the 1month, how many observation have missing values in both 1month and
> > 2month, how many observations have missing values in 1month, 2month, 3
> > month and so on.....
> >
> > I can use an if else statement and create a new variable based on the
> > missing values or Nmiss() function in SQL. But my problem is I have a
> lot
> > variables and 24 months of data with me and i want a cumulative missing
> > values. So if you guys can think of any other way ( PROC SQL or some
> macro
> > structure) please let me know. I would very happy to answer any question
> > on this. Thanks a lot.
> >
> > cheers,
> > Lazybone(Well...I ain't Lazy....)
> >
> >
>
>
|