Date: Sun, 3 Sep 2006 18:56:16 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: proc informat/ proc format?
Actually, there is no PROC INFORMAT. Informats can be built using the
INVALUE statement in PROC FORMAT.
Another place where one finds a lapse in the symmetry of terminology: When
an INPUT statement uses informats to read data, it's called "format style"
input and not "informat style".
On Fri, 1 Sep 2006 05:39:30 -0700, Arjen <a.benedictus@GMAIL.COM> wrote:
>Hello SAS-L,
>
>Yesterday I posted a question to which a proc informat-solution proved
>to be a good answer. Today I decided that I will be able to cut a lot
>of code when I do it the other way round, that is, to start with
>numeric values and transform them into character variables later on.
>Hence the question: I want to convert these numerical variables into
>character variables using proc format, but I get an error saying
>"invalid numeric data". Any suggestions? (tested code below)
>
>Thanks!
>
>Arjen
>
>%LET d1 = VirusOne;
>%LET d2 = VirusTwo;
>%LET d3 = VirusThree;
>
>data have;
> input &d1 &d2 &d3 @@;
> cards;
> 1 2 2 2 2 3 2 1 1 3
> 3 1 3 2 2 1 2 1 2 1
> 1 1 2 2 2 3 2 3 2 2
> ;
>run;
>
>proc format ;
> value result
>1= "p"
>2= "n"
>3= "u"
>other = .
>;
>run;
>
>data have2 (DROP=I);
> set have;
> array nn [1:3] &D1 &D2 &D3;
> array zz [1:3] z&D1 z&D2 z&D3;
> do i = 1 to 3;
> zz[i] = put (nn[i], result.);
> end;
>run;
|