LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (February 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 7 Feb 2008 12:44:24 -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 ?
Comments: To: iw1junk@comcast.net
In-Reply-To:  <020720081726.12224.47AB3F520005634C00002FC0220702085305029A06CE9907@comcast.net>
Content-Type: text/plain; charset="us-ascii"

Ian wrote:

"Your subject and the responses appear to be under the impression there is something special about CARDS and INFORMAT."

I disagree.

Where do the responses suggest that any of this is limited to CARDS input?

-Randy

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of iw1junk@comcast.net Sent: Thursday, February 07, 2008 12:27 PM To: SAS(r) Discussion Cc: Richard A. DeVenezia Subject: Re: In CARDS input a period as a character instead of as a missing value ?

Summary: INPUT with missing character values #iw-value=1

Richard,

Your subject and the responses appear to be under the impression there is something special about CARDS and INFORMAT. Actually it has nothing to do with the type of file and everything is about the difference between the $ and $CHAR informats.

80 filename temp temp ; 81 data _null_ ; 82 file temp ; 83 put "." ; 84 put ". x" ; 85 put ".x" ; 86 run ; 87 88 data w ; 89 infile temp truncover ; 90 length a b c d e $ 8 ; 91 informat c $char8. d $8. ; 92 input 93 @1 a $char8. 94 @1 b $8. 95 @1 c 96 @1 d 97 @1 e :$char8. 98 @1 f :$8. 99 ; 100 put _all_ ; 101 run ;

a=. b= c=. d= e=. f= _ERROR_=0 _N_=1 a=. x b=. x c=. d= e=. f= _ERROR_=0 _N_=2 a=.x b=.x c=.x d=.x e=.x f=.x _ERROR_=0 _N_=3

The $ informat deletes leading blanks, stops at a blank, and treats the period with at most blanks as character missing. The $CHAR informat picks up exactly what is there without any translation.

Personally I strongly prefer to see the informat in the INPUT statement and $CHAR informat.

Shortly after I first started using SAS, I found myself around mid- night trying to read a file with 2000 byte records and mostly one or two byte variables and explain why one of the character variables was coming up with missing values in a freq, when a external dump said it was not. (Fortunately this happened after the time when I could only get one or two jobs run per day.)

Ian Whitlock =============== Date: Wed, 6 Feb 2008 22:41:43 -0500 Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET> Sender: "SAS(r) Discussion" From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET> Organization: Internet News Service Subject: In CARDS input a period as a character instead of as a missing value ? Comments: To: sas-l

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/


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