LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 1 May 2002 18:22:49 +0100
Reply-To:     Peter Crawford <peter.crawford@DB.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <peter.crawford@DB.COM>
Subject:      Re: Behavior of SAS with dlm= dsd and incorrect informat,
              clarificati on??
Comments: To: "Delaney, Kevin P." <khd8@CDC.GOV>
Content-type: text/plain; charset=iso-8859-1

It seems to make sense ! As I understand the input pointer, it goes like this var2 has informat $12. so the next12 are given to that variable, leaving the input pointer on ',' for lines 1,2 and 4 For line 3 the pointer should be on the 'm' of 'more' (but that line got eaten by the default FlowOver) Because an explicit informat length has been used, the normal DSD behaviour - "skip after the delimiter" doesn't happen var3 is read starting at the current pointer position On all lines that is non-numeric - either delimiter ',' or 'm' or more. Being on the delimiter is the same as occurs with consecutive delimiters. Because no explicit informat length was used, DSD behaviour occurs and the input pointer moves after the dlm. var4 is read from the date field on lines1 and 4 and the final '2' on line2

of course that date informat is commented out, but ... the same rules apply to the pointer when an explicit informat length is given, the normal "skip after the delimiter" does not apply ! To show what is happening to the column pointer, I broke the input statement into each stage, to capture the column pointer position in the input buffer. The put _infile_ $varying40. c; prints the buffer only up to the current column position. This shows that after reading VAR2, the position is at a delimiter for lines 1, 2 and 4. That is why VAR3 is missing for those lines 346 Data one ; 347 Infile datalines dlm="," dsd column=c length=l ; 348 input @; put @3 _infile_ $varying40. l; 349 Input var1 @; put '1=' _infile_ $varying40. c @45 var1 ; 350 Input var2 $12. @; put '2=' _infile_ $varying40. c @45 var2 ; 351 Input var3 @; put '3=' _infile_ $varying40. c @45 var3 ; 352 Input var4 @; put '4=' _infile_ $varying40. c @45 var4 ; 353 Input var5 @; put '5=' _infile_ $varying40. c @45 var5 ; 354 Input var6 ; put '6=' _infile_ $varying40. c @45 var6 ; 355 datalines;

1,abcdefghijkl,2,010202,1,2 1=1,a 1 2=1,abcdefghijkl, abcdefghijkl 3=1,abcdefghijkl,2 . 4=1,abcdefghijkl,2,0 2 5=1,abcdefghijkl,2,010202,1 10202 6=1,abcdefghijkl,2,010202,1,2 1 2,abc,2,010302,1,2 1=2,a 2 2=2,abc,2,010302, abc,2,010302 3=2,abc,2,010302,1 . 4=2,abc,2,010302,1,2 1 5=2,abc,2,010302,1,2 2 6=3,d 3 4,abcdehjkinkd,,010302,1,2 1=4,a 4 2=4,abcdehjkinkd, abcdehjkinkd 3=4,abcdehjkinkd,, . 4=4,abcdehjkinkd,,0 . 5=4,abcdehjkinkd,,010302,1 10302 6=4,abcdehjkinkd,,010302,1,2 1 NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.ONE has 3 observations and 6 variables. NOTE: The DATA statement used 0.01 CPU seconds and 18975K. 360 ;

Datum: 01/05/2002 16:16 An: SAS-L@LISTSERV.UGA.EDU

Antwort an: "Delaney, Kevin P." <khd8@CDC.GOV>

Betreff: Behavior of SAS with dlm= dsd and incorrect informat, clarificati on?? Nachrichtentext:

This is a question about how data is read into the PDV given conflicting options in SAS...

If I (incorrectly) code:

Data one; Infile datalines dlm="," dsd; Input var1 var2 /*$*/ $12. var3 /*mmddyy6. */ var4 var5 var6; *without the ":"; datalines; 1,abcdefghijkl,2,010202,1,2 2,abc,2,010302,1,2 3,dfghighghendmore,2,010202,1,2 4,abcdehjkinkd,,010302,1,2 ; Run;

What are the $12. and mmddyy6. actually telling SAS at that point??

I believe I understand that the $12. is telling SAS to read 12 columns, regardless of delimiter??

It looks as though SAS is ignoring the delimiter only for this variable??

But if the $12 includes one or more delimiters it keeps reading until it finds the next one, even to the point of going to a new line (without Missover), yet Var3 is always missing??

Also, how is SAS interpreting the Date INFORMAT without the ":" ?? If I just include the incorrect DATE Informat, SAS can interpret the DATE, but then var4 is always missing??

It seems that in addition to reading as many columns as the (length??, informat??) it also sucks up the next delimiter otherwise there is no reason for Obs1 to have Var3 missing, or in the date INFORMAT example, for Var4 to always be missing??

You can never have too much explanation of the inner workings of SAS's mind...

Kevin

--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


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