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 (August 2003, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 28 Aug 2003 10:52:21 -0400
Reply-To:     Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:      Re: input specific lines with overlapping input?
Comments: To: Arthur Ellen <arte@PANIX.COM>
Content-Type: text/plain

Arthur,

As a matter of style, I would prefer two steps to make the intent clearer.

data a ; infile cards firstobs = 2 obs = 2 ; input (achar1-achar7) ($char1.) ; cards ; aa 1234567 cccc dddd eeeee1234 eeeeeeeee eeeee5678 ;

data b ; infile cards firstobs = 5; input @6 (echar1-echar4) ($char1.) ; cards ; aa 1234567 cccc dddd eeeee1234 eeeeeeeee eeeee5678 ;

One advantage to this second approach is that it produces consistent results when the data is read from an external data set with trailing blanks removed.

IanWhitlock@westat.com

-----Original Message----- From: Arthur Ellen [mailto:arte@PANIX.COM] Sent: Thursday, August 28, 2003 7:37 AM To: SAS-L@LISTSERV.UGA.EDU Subject: input specific lines with overlapping input?

/* reading specific lines with overlapping input */ /* is there a better way to go to just line 2 and read it or a portion of it and then go to line 4 and read an overlapping piece of it? */

data a(keep=achar1-achar7) b(keep=echar1-echar4); input (achar1-achar7) ($char1.) @6 (echar1-echar4)($char1.); if _n_=2 then output a; if _n_>4 then output b; cards; aa bbbbbbb cccc dddd eeeeeeeee eeeeeeeee eeeeeeeee ; proc print data=a; proc print data=b; run;


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