Date: Fri, 21 Jun 2002 13:41:08 +0800
Reply-To: YCF <s007422@CUHK.EDU.HK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: YCF <s007422@CUHK.EDU.HK>
Organization: The Chinese University of Hong Kong
Subject: Re: Still have problems about missing data treatment
I can't use @n as the pattern of the dataset is quite irregular.
Ian has written a program like this:
> data w ;
> infile cards truncover ;
> input date :yymmdd10. s :$char7. x y $ z ;
> if z = . and not verify ( y , " 0123456789." ) then
> do ;
> z = input ( y , best32. ) ;
> y = " ." ;
> end ;
> cards ;
> 2001-04-09 s007552 25104278 6
> 2001-04-09 s001123 1 UC 7
> 2001-04-09 a554413 2 NA 5
> ;
>proc print;
>run;
However, it works only if there is only one column after column 4. I think a
little modification is required.
>
> |--------+----------------------->
> | | YCF |
> | | <s007422@CUHK|
> | | .EDU.HK> |
> | | |
> | | 22/06/2002 |
> | | 02:43 AM |
> | | Please |
> | | respond to |
> | | YCF |
> | | |
> |--------+----------------------->
> >--------------------------------------------------------|
> | |
> | To: SAS-L@LISTSERV.UGA.EDU |
> | cc: (bcc: Philip Crane/Policy/VWA) |
> | Subject: Still have problems about missing |
> | data treatment |
> >--------------------------------------------------------|
>
>
>
>
>
> Hi all,
> I have posted this problem before but this time I would like to
specify
> my problem more clearly. Now I have a dataset like this: (Please maximize
> the window)
> date id usage1 usage2 state1
> usage3 state2
> 2001-04-09 s005513 222981144 7 300
> 2001-04-09 s005537 12 16 NOT EXPIRED 300
NOT
> STARTED
> 2001-04-09 a004122 1233344 18
> 300 STARTED
> ......
>
> The problem is that the variables "state1" and "state2" usually contain
> missing data, and there is no "." sign but just a LONGER SPACE to denote
it.
> So how to read these data in? My expected output is like this:
>
> date id usage1 usage2
> state1 usage3 state2
> 2001-04-09 s005513 222981144 7 .
> 300 .
> 2001-04-09 s005537 12 16 NOT EXPIRED
300
> NOT STARTED
> 2001-04-09 a004122 1233344 18 .
> 300 STARTED
>
> Thanks very much for your help!
>
> YCF
|