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 (September 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 14 Sep 2008 20:08:09 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>"
              <schreier.junk.mail@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>"
              <schreier.junk.mail@GMAIL.COM>
Subject:      Re: Reading Parallel Tables in same sheets

On Thu, 11 Sep 2008 04:53:55 -0700, Lokesh <vyom009@GMAIL.COM> wrote:

>hi all, > >i have sheet in this form: > > Table 1 Table 2 >var1 var2 var3 var4 var1 var2 var3 var4 >XXX | XXX | XXXX | XXX | | XXX | XXX | XXXX | XXX | >XXX | XXX | XXXX | XXX | | XXX | XXX | XXXX | XXX | >XXX | XXX | XXXX | XXX | | XXX | XXX | XXXX | XXX | > >XXX | XXX | XXXX | XXX | | XXX | XXX | XXXX | XXX | >XXX | XXX | XXXX | XXX | | XXX | XXX | XXXX | XXX | > ><--- blank rows >XXX | XXX | XXXX | XXX | | XXX | XXX | XXXX | XXX | >XXX | XXX | XXXX | XXX | | XXX | XXX | XXXX | XXX | >XXX | XXX | XXXX | XXX | | XXX | XXX | XXXX | XXX | >XXX | XXX | XXXX | XXX | | XXX | XXX | XXXX | XXX | > ^ > | > | Blank column > >where: XXX --> var values, | --> delimiter, | | --> blank >column, >Table 1 & Table 2 have same variables but for different things, these >tables are in one csv sheet. > >hv tried to read them in one infile but havnt succeeded, however I can >read table one by using 'missover'. > >Even if i have both tables in one file tht wud b alrite (can later >resolve in separate files) > >Any suggestions are welcome. > > >Cheers >Lokesh

Examples are very helpful, but this one is difficult because it's hard to know what's literal, what's place-holder, what's annotation. So here's my guess at a literal example:

data _null_; file 'demo'; put 'Table 1 | | | Table2 | |' / 'var1 | var2 | | var1 | var2 |' / '0111 | 0112 | | 0121 | 0122 |' / '0211 | 0212 | | 0221 | 0222 |' / '0311 | 0312 | | 0321 | 0322 |' / / '0511 | 0512 | | 0521 | 0522 |' ; run;

Skipping a column is a problem unless you have absolute column positions. Instead, read the empty column but immediately discard what you've read:

data one two; infile 'demo' dlm='|' firstobs = 3; input @; if missing(_infile_) then delete; input var1-var2 @; output one; input var1 var1-var2 ; output two; run;

Results (ONE then TWO):

Obs var1 var2

1 111 112 2 211 212 3 311 312 4 511 512

Obs var1 var2

1 121 122 2 221 222 3 321 322 4 521 522


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