Date: Wed, 18 Aug 2004 23:10:43 -0400
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: Delimiter question
I don't think anybody actually explained why the original code did not work.
As coded, the pipe characters do govern the scanning of AU and NADA. That's
known as list style input and it leaves the pointer at the first character
after the second pipe. Then it scans precisely 30 characters for DEPT_NAME
and another 30 for APPROVER_NAME. The third pipe has no role as a
delimiter. If you edit the first record and eliminate one of the space
characters between "MAIN" and the third pipe, yuou will see the pipe turn
up as the last character in in DEPT_NAME.
The colon modifier changes the rules and implements sort of a hybrid type
of input, partly list style and partly informat-controlled. The pipes
define the segments to be scanned and the informat takes care of the
conversion.
You also could have solved your problem with
INPUT au nada Dept_Name $char30. +1 Approver_Name $char30.;
On Mon, 16 Aug 2004 16:22:01 -0700, David W Neylon
<David.W.Neylon@WELLSFARGO.COM> wrote:
>Code:
>DATA auinfo (KEEP=au Dept_Name Approver_Name);
> INFILE auinfo delimiter='|';
> INPUT au nada Dept_Name $char30. Approver_Name $char30.;
>proc sort data=auinfo;by au;
>proc print noobs data=auinfo;
>
>Data:
>1|0|SAN FRANCISCO MAIN |XXXXXX,BRIAN E
>2|0|BLXXXXAWK |XXXXXXXXXX,ELAINE C
>3|0|CONXXX LOOP |XXXXXXX,RACHELLE L
>4|0|BROAXXXXXXXXXT AVENUE OFFICE |XXXX,FLORENCE S
>5|0|SXXXXX MARKETPLACE |XXXXXXE,ROBERT A
>6|0|CIVIC CXXXXX OFFICE |XX,LXXXX
>8|0|COLUMBUS AVENUE OFFICE |XXXX XXXXXXX,GAIL Y
>12|0|FILLMORE-CALIFORNIA OFFICE |XXXXXXXXX,ALEX E
>14|0|CREDIT CARD SERVICE CENTER BR |XXXXXXXX,AMY
>17|0|OAKHURST RALEY'S OFFICE |XXXXXXXX,JANICE
>18|0|GEARY-NINETEENTH AVENUE OFFICE|XX,XXXXX K
>
>Output:
>Obs au Dept_Name Approver_Name
>
> 1 1 SAN FRANCISCO MAIN |XXXXXX,BRIAN E
> 2 2 BLACKHAWK |XXXXXXXXXX,ELAINE C
> 3 3 CONROE LOOP |XXXXXXX,RACHELLE L
> 4 4 BROADWAY-GRANT AVENUE OFFICE |XXXX,FLORENCE S
> 5 5 SUNSET MARKETPLACE |XXXXXXX,ROBERT A
> 6 6 CIVIC CENTER OFFICE |XX,XXXXX
> 7 8 COLUMBUS AVENUE OFFICE |XXXX XXXXXXX,GAIL Y
> 8 12 FILLMORE-CALIFORNIA OFFICE |XXXXXXXXX,ALEX E
> 9 14 CREDIT CARD SERVICE CENTER BR |XXXXXXXX,AMY
> 10 17 OAKHURST RALEY'S OFFICE |XXXXXXXX,JANICE
> 11 18 GEARY-NINETEENTH AVENUE OFFICE |XX,XXXXX K
>
>Why is the Approver_Name picking up the delimiter character??? Does it
>relate to the space between the delimiters for the Dept_Name being exactly
>the same length as the data I want? Or should I be specifying something
>other than $char30.?
>
>David W Neylon, Sr
>
>Consultant/Data Security Analyst
>Corporate Information Security - CIS
>Mainframe Security Technical Services
>(480) 774-3155
>David.W.Neylon@WellsFargo.com
>Wells Fargo Confidential
>This message may contain confidential and/or privileged information. If
>you are not the addressee or authorized to receive this for the addressee,
>you must not use, copy, disclose, or take any action based on this message
>or any information herein. If you have received this message in error,
>please advise the sender immediately by reply e-mail and delete this
>message. Thank you for your cooperation.
|