Date: Mon, 24 Jan 2005 22:35:26 -0500
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Reading a Tab Delimited File
First, let's have a smaller example, one which will not get munged by
wrapping. Try this one:
data _null_;
file 'demo';
put 'Date:|01/12/2005';
put 'ACD|Skill Num|Skill Name|Avg Speed Ans';
put 'Totals|ACD|ACD|8.24714851379';
put 'BANKCARD_SVCS|458|TE HLD High Pri S458|0.00613496918231';
put 'BANKCARD_SVCS|459|TE National S459|0.354058712721';
put 'BANKCARD_SVCS|469|TE HLD Spanish S469|134.063827515';
put 'Date:|01/11/2005';
put 'ACD|Skill Num|Skill Name|Avg Speed Ans';
put 'Totals|ACD|ACD|2.24423956871';
put 'BANKCARD_SVCS|458|TE HLD High Pri S458|0.019417475909';
put 'BANKCARD_SVCS|459|TE National S459|0.0183333326131';
put 'BANKCARD_SVCS|469|TE HLD Spanish S469|31.1774196625';
run;
If the pattern is as regular as suggested, a couple of INPUT features
should handle things. Here is tested code:
data demo;
infile 'demo' dlm='|';
input #1 @7 date mmddyy10. @;
format date date9.;
do line = 4 to 6; drop line;
input #line ACD: $15.
SkillNum
SkillName: $20.
AvgSpeedAns
@;
output;
end;
run;
Notice the use of the line pointer (#) and the trailing at sign (@).
On Fri, 14 Jan 2005 08:41:55 -0800, Sekhar <ckalisetty@GMAIL.COM> wrote:
>Hello All
>I am having a tough time reading a tab delimited file.
>My file looks follows.
>
>Date:|01/12/2005
>ACD|Skill Num|Skill Name|Avg Speed Ans|Avg Aban Time|ACD Calls|Avg ACD
>Time|Avg ACW Time|Aban Calls|Max Delay|Flow In|Flow Out|Extn Out
>Calls|Avg Extn Out Time|% ACD Time|% Ans Calls|% Within Service Level
>Totals|ACD|ACD|8.24714851379|281|789|438.997467041|463.315582275|5|1205|0|0
|1663|220.772705078|30.35|99.37|
>BANKCARD_SVCS|458|TE HLD High Pri
>S458|0.00613496918231||163|853.582824707|973.239257813|0|1|0|0|1368|225.820
175171|43.65|100.00|100.0
>BANKCARD_SVCS|459|TE National
>S459|0.354058712721|20|579|333.129547119|345.939544678|1|72|0|0|228|250.188
598633|18.91|99.83|99.3
>BANKCARD_SVCS|469|TE HLD Spanish
>S469|134.063827515|346.25|47|305.382965088|140.829788208|4|1205|0|0|67|17.6
119403839|12.41|92.16|47.1
>Date:|01/11/2005
>ACD|Skill Num|Skill Name|Avg Speed Ans|Avg Aban Time|ACD Calls|Avg ACD
>Time|Avg ACW Time|Aban Calls|Max Delay|Flow In|Flow Out|Extn Out
>Calls|Avg Extn Out Time|% ACD Time|% Ans Calls|% Within Service Level
>Totals|ACD|ACD|2.24423956871|575.666687012|868|416.888244629|278.236175537|
9|1663|0|0|1749|143.236709595|26.81|98.97|
>BANKCARD_SVCS|458|TE HLD High Pri
>S458|0.019417475909||206|750.592224121|419.228149414|0|1|0|0|1454|154.31361
3892|38.98|100.00|100.0
>BANKCARD_SVCS|459|TE National
>S459|0.0183333326131||600|308.421661377|239.119995117|0|1|0|0|193|115.60103
6072|15.11|100.00|100.0
>BANKCARD_SVCS|469|TE HLD Spanish
>S469|31.1774196625|575.666687012|62|357.80645752|188.32258606|9|1663|0|0|10
2|37.6274528503|22.09|87.32|78.9
>Date:|01/10/2005
>ACD|Skill Num|Skill Name|Avg Speed Ans|Avg Aban Time|ACD Calls|Avg ACD
>Time|Avg ACW Time|Aban Calls|Max Delay|Flow In|Flow Out|Extn Out
>Calls|Avg Extn Out Time|% ACD Time|% Ans Calls|% Within Service Level
>Totals|ACD|ACD|28.2469882965|179.657150269|996|470.196777344|418.259033203|
140|2486|0|0|1569|159.732955933|33.86|87.68|
>BANKCARD_SVCS|458|TE HLD High Pri
>S458|4.44360923767|4|266|785.293212891|672.567687988|1|84|0|0|1229|166.5296
93604|46.80|99.63|91.0
>BANKCARD_SVCS|459|TE National
>S459|12.7342338562|56.8181800842|666|339.414428711|296.378387451|110|184|0|
0|249|145.763046265|20.64|85.82|71.9
>BANKCARD_SVCS|469|TE HLD Spanish
>S469|288.609375|651.655151367|64|521.53125|629.609375|29|2486|0|0|91|106.16
4833069|36.53|68.82|29.0
>
>
>
>>From the first line I want to read only the date part. The second line
>represents the variable names starting from "ACD" and up to "% Within
>Service Level". I don't want to read the line starting with "Totals"
>and ending with "87.68". This represent s the totals and I don't need
>it. I want the three lines of data starting at "BANKCARD_SVCS" .
>I want to repeat this for all dates . From the second date I want only
>the data and date not the variable names.
>Any ideas? I tried using proc inport and noe in the middle of data
>step.
>Any help is appreciated.
>
>Thanks
>Sekhar