[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: coding different missing values
From:       Aaron Moynahan <aaron.moynahan () VERIZON ! NET>
Date:       2003-07-31 20:26:37
[Download RAW message or body]

A slightly better example:
data temp;
  missing A B C;
  input id trt outcome;
datalines;
1 1 6
2 1 A
3 1 7
4 2 3
5 2 B
6 2 C
;
run;

options nocenter;
proc print data=temp; run;

Obs    id    trt    outcome

 1      1     1        6
 2      2     1        A
 3      3     1        7
 4      4     2        3
 5      5     2        B
 6      6     2        C

"Aaron Moynahan" <aaron.moynahan@verizon.net> wrote in message
news:fTeWa.34$mZ6.12@nwrdny02.gnilink.net...
> Kevin,
>
> I don't understand the utility of coded missing values since missing
usually
> is considered as a null value which means the absense of information for
> that field. I probably would put this missing status in a different field.
> However, I did work with a guy who did this kind of stuff and I made an
> example from what I remembered of it.
>
> data temp;
>   length tmp $8;
>   input id trt tmp $;
>   select(tmp);
>     when("A") outcome=.a;
>     when("B") outcome=.b;
>     when("C") outcome=.c;
>     otherwise outcome=input(tmp,2.);
>   end;
> datalines;
> 1 1 6
> 2 1 A
> 3 1 7
> 4 2 3
> 5 2 B
> 6 2 C
> ;
> run;
>
> options nocenter;
> proc print data=temp; run;
>
> Obs    id    trt    outcome
>
>  1      1     1        6
>  2      2     1        A
>  3      3     1        7
>  4      4     2        3
>  5      5     2        B
>  6      6     2        C
>
>
>
> "Kevin F. Spratt" <kevin-spratt@UIOWA.EDU> wrote in message
> news:5.1.0.14.2.20030731141430.00abb2e0@blue.weeg.uiowa.edu...
> > I wish to import an excel spreadsheet into sas.
> >
> > The spreadsheet has different codes for different kinds of missing
> > values.
> >
> > lets say A = missing, B = Don't know, and C=Not applicable.
> >
> > Thus, I might have
> >
> > id   trt   outcome
> > 1      1      6
> > 2      1      A
> > 3      1      7
> > 4      2      3
> > 5      2      B
> > 6      2      C
> > .
> > .
> > .
> >
> > If i were creating this file from a flat file, I would use the
> > following code:
> >
> > data new;
> >   Missing A B C;
> >
> >   infile datain;
> >
> > input id trt outcome;
> >
> > However, when using proc import I can't or don't know how to
> > include the missing statement in the creation of the data set
> > imported from the excel sheet.
> >
> > My code is:
> >
> > proc import datafile=excel01 dbms=excel2000 replace out=work.lbp;
> >              sheet='sheet1';
> >              getnames=yes;
> >
> > The code works to import the data, but all of the As, Bs, and Cs
responses
> > in the data set are converted to .
> >
> > Any ideas greatly appreciated.
> >
> >
> >
> >
> > ________________________________________________________________
> >                                       _____________
> > Kevin F. Spratt, Ph.D.              |             |
> > Iowa Testing Programs        (ITP) (               )
> > University of Iowa Back Care (UIBC) \              \_ University
> > Iowa Spine Research Center   (ISRC)  \          *    \ of Iowa
> > 224-D Lindquist Center                \              / Hawkeyes
> > The University of Iowa                 |____________ )
> > Iowa City, Iowa 52242                               V
> > (319) 335-5572         (voice-Lindquist)
> > (319) 335-9921         (voice-Westlawn)
> > (319) 335-6399         (fax)
> > (319  530-8254         (cell & Voice mail)
> > Kevin-Spratt@Uiowa.edu (e-mail)
> > ________________________________________________________________
>
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic