LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 14 Nov 2007 10:55:03 -0600
Reply-To:     Mary <mlhoward@avalon.net>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mary <mlhoward@AVALON.NET>
Subject:      Re: Missing values....
Comments: To: Nirmal kumar <lazybone2k@GMAIL.COM>
Content-Type: text/plain; charset="iso-8859-1"

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 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....) > >


Back to: Top of message | Previous page | Main SAS-L page