Date: Thu, 7 Feb 2008 10:33:30 -0500
Reply-To: Randy Herbison <RandyHerbison@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Randy Herbison <RandyHerbison@WESTAT.COM>
Subject: Re: In CARDS input a period as a character instead of as a
missing value ?
In-Reply-To: <7367b4e20802070717u2d5bb2f7u4cfe907f5634c8ee@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
Good point. One difference when using the $char. informat compared to
the $period informat I created, is that the $char informat will preserve
leading blanks in the stored data. That may or may not be desirable.
-Randy
-----Original Message-----
From: data _null_, [mailto:datanull@gmail.com]
Sent: Thursday, February 07, 2008 10:18 AM
To: Randy Herbison
Cc: Richard A. DeVenezia; SAS-L@listserv.uga.edu
Subject: Re: In CARDS input a period as a character instead of as a
missing value ?
The informat technique works with $CHAR too, no need to create user
defined informat.
data foo;
length a b c $8;
infile cards dlm=',';
input a b c;
informat _char_ $char200.;
cards;
abc,.,def
run;
On Feb 7, 2008 10:00 AM, Randy Herbison <RandyHerbison@westat.com>
wrote:
> I like data _null_'s modified list input for the data step. Inputting
> a single period as character data can produce missing data in other
> contexts too. The default behavior for VIEWTABLE is to treat it as
> missing. An informat can maintain the period for both the data step
> and interactive applications such as VIEWTABLE.
>
> -Randy
>
> proc format;
> invalue $period
> '.'='.';
> run;
>
> data test;
> length c $ 18;
> input c $;
> informat c $period.;
> cards;
> .
> 1
> 2
> 3
> 123456789123456789
> ;
>
>
> -----Original Message-----
> From: owner-sas-l@listserv.uga.edu
> [mailto:owner-sas-l@listserv.uga.edu]
> On Behalf Of Richard A. DeVenezia
> Sent: Wednesday, February 06, 2008 10:42 PM
> To: sas-l@uga.edu
> Subject: In CARDS input a period as a character instead of as a
missing
> value ?
>
>
> The following code inputs the period (.) as a missing value. Is there
> an option to treat periods as just plain text when being read ?
>
> data foo;
> length a b c $8;
> infile cards dlm=',';
> input a b c;
> cards;
> abc,.,def
> run;
>
> --
> Richard A. DeVenezia
> http://www.devenezia.com/
>
|