<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: reading fixed formatted file where rows repeat in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62709#M17866</link>
    <description>You do not post what you want output dataset looks like?&lt;BR /&gt;
If you only want obs start with MIT then use:&lt;BR /&gt;
[pre]&lt;BR /&gt;
if upcase(row) eq: 'MIT' then output;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
to clean data.&lt;BR /&gt;
If you want much more obs different from 'MIT' ,Emmmm there might be to need more code.&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
    <pubDate>Wed, 11 May 2011 01:07:06 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-05-11T01:07:06Z</dc:date>
    <item>
      <title>reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62697#M17854</link>
      <description>I'm working on a fixed format file where the file contains multiple entities.  For example, the file may contain data for a student from row 1-99 and then another student will start at 100.  I was thinking about loading the whole file in a dataset and parse it with proc sql.  Below is a very brief example of 2 students.&lt;BR /&gt;
&lt;BR /&gt;
StudentA&lt;BR /&gt;
&lt;BR /&gt;
ADVISOR:&lt;BR /&gt;
PLACEMENT TESTS:    DISMISSALS:  0&lt;BR /&gt;
CURRENT STANDING: GS&lt;BR /&gt;
&lt;BR /&gt;
Completion of program will be determined by completion of each&lt;BR /&gt;
requirement, required credit hours and final Institutional GPA.&lt;BR /&gt;
&lt;BR /&gt;
Program Status: In Progress&lt;BR /&gt;
                                  Current..........   Anticipated(*).......&lt;BR /&gt;
                       Required   Earned  Remaining   Additional  Remaining&lt;BR /&gt;
Institutional Credits:    30.00    87.00       0.00         0.00       0.00&lt;BR /&gt;
Institutional GPA....:    2.000    3.132        Met&lt;BR /&gt;
Combined      Credits:    94.00    87.00       7.00         0.00       7.00&lt;BR /&gt;
Combined      GPA....:    2.000    3.132        Met&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
StudentB&lt;BR /&gt;
&lt;BR /&gt;
Completion of program will be determined by completion of each&lt;BR /&gt;
requirement, required credit hours and final Institutional GPA.&lt;BR /&gt;
&lt;BR /&gt;
Program Status: In Progress&lt;BR /&gt;
                                  Current..........   Anticipated(*).......&lt;BR /&gt;
                       Required   Earned  Remaining   Additional  Remaining&lt;BR /&gt;
Institutional Credits:    30.00    49.00       0.00         8.00       0.00&lt;BR /&gt;
Institutional GPA....:    2.000    3.174        Met&lt;BR /&gt;
Combined      Credits:   106.00    49.00      57.00         8.00      49.00&lt;BR /&gt;
Combined      GPA....:    2.000    3.174        Met</description>
      <pubDate>Thu, 05 May 2011 13:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62697#M17854</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-05-05T13:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62698#M17855</link>
      <description>PROC SQL?&lt;BR /&gt;
&lt;BR /&gt;
Recommend using a SAS DATA step approach, where you load the current input record buffer, using IF &lt;EXPRESSION&gt; THEN DO / END logic, detect what specify "record format type" it is, then inside the DO/END portion have INPUT statement code to parse each "type".&lt;BR /&gt;
&lt;BR /&gt;
Use LENGTH or ATTRIB statements to declare your SAS CHARACTER and NUMERIC formatted variables.&lt;BR /&gt;
&lt;BR /&gt;
Also, you will likely need to use a RETAIN statement for those variables that will be input in records/rows prior to the last one where you would do your OUTPUT to create a composite observation.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
DATA ;&lt;BR /&gt;
* define LENGTH/ATTRIB and RETAIN statement info here. ;&lt;BR /&gt;
input @;&lt;BR /&gt;
if _infile_ =: 'A' then do;&lt;BR /&gt;
  * input code here for row-type A. ;&lt;BR /&gt;
end;&lt;BR /&gt;
else if _infile_ =: 'B' then do;&lt;BR /&gt;
  * input code here for row-type B. ;&lt;BR /&gt;
end;&lt;BR /&gt;
else do;&lt;BR /&gt;
  * output logic goes here - depends on what detects no ;&lt;BR /&gt;
  * more input for the current item - maybe a blank record? ;&lt;BR /&gt;
  OUTPUT;&lt;BR /&gt;
end;&lt;/EXPRESSION&gt;</description>
      <pubDate>Thu, 05 May 2011 15:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62698#M17855</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-05-05T15:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62699#M17856</link>
      <description>What if there is unknown amount of students?  In my example I listed 2 but in reality there could be 22,000 students.</description>
      <pubDate>Thu, 05 May 2011 15:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62699#M17856</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-05-05T15:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62700#M17857</link>
      <description>Can you explain how to parse it with sql.&lt;BR /&gt;
I only can offer you how to load the whole file into dataset.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data temp;&lt;BR /&gt;
 infile datalines length=len ;&lt;BR /&gt;
 input row $varying200. len;&lt;BR /&gt;
datalines;&lt;BR /&gt;
StudentA&lt;BR /&gt;
&lt;BR /&gt;
ADVISOR:&lt;BR /&gt;
PLACEMENT TESTS: DISMISSALS: 0&lt;BR /&gt;
CURRENT STANDING: GS&lt;BR /&gt;
&lt;BR /&gt;
Completion of program will be determined by completion of each&lt;BR /&gt;
requirement, required credit hours and final Institutional GPA.&lt;BR /&gt;
&lt;BR /&gt;
Program Status: In Progress&lt;BR /&gt;
Current.......... Anticipated(*).......&lt;BR /&gt;
Required Earned Remaining Additional Remaining&lt;BR /&gt;
Institutional Credits: 30.00 87.00 0.00 0.00 0.00&lt;BR /&gt;
Institutional GPA....: 2.000 3.132 Met&lt;BR /&gt;
Combined Credits: 94.00 87.00 7.00 0.00 7.00&lt;BR /&gt;
Combined GPA....: 2.000 3.132 Met&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
StudentB&lt;BR /&gt;
&lt;BR /&gt;
Completion of program will be determined by completion of each&lt;BR /&gt;
requirement, required credit hours and final Institutional GPA.&lt;BR /&gt;
&lt;BR /&gt;
Program Status: In Progress&lt;BR /&gt;
Current.......... Anticipated(*).......&lt;BR /&gt;
Required Earned Remaining Additional Remaining&lt;BR /&gt;
Institutional Credits: 30.00 49.00 0.00 8.00 0.00&lt;BR /&gt;
Institutional GPA....: 2.000 3.174 Met&lt;BR /&gt;
Combined Credits: 106.00 49.00 57.00 8.00 49.00&lt;BR /&gt;
Combined GPA....: 2.000 3.174 Met &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 06 May 2011 03:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62700#M17857</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-06T03:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62701#M17858</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
"What if there is unknown amount of students?"&lt;BR /&gt;
&lt;BR /&gt;
Read Scott's example carefully. It fully covers this. You might have to look up the function of an '@' used in an input statement.&lt;BR /&gt;
&lt;BR /&gt;
Cheers&lt;BR /&gt;
Patrick</description>
      <pubDate>Fri, 06 May 2011 03:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62701#M17858</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-05-06T03:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62702#M17859</link>
      <description>SBR's solution seems to hard code for each student.  Is there something in the input file that you could use as a trigger to indicate when a new student's records is starting?</description>
      <pubDate>Fri, 06 May 2011 11:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62702#M17859</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2011-05-06T11:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62703#M17860</link>
      <description>In looking into the file deeper it looks like after the second row of "=====" is the "meat" of the file.&lt;BR /&gt;
&lt;BR /&gt;
COM-206 INTERPERSONAL COM.......... 92/WI    B         3&lt;BR /&gt;
================================================================================&lt;BR /&gt;
N) 7: MULTICULTURAL - 3 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; SELECT ONE COURSE FROM:&lt;BR /&gt;
&amp;gt; GEO 102, 201, 202&lt;BR /&gt;
&amp;gt; LIT 217, 234&lt;BR /&gt;
&amp;gt; PLS 200&lt;BR /&gt;
&amp;gt; PSY 225&lt;BR /&gt;
04/04/11                                    Page 3&lt;BR /&gt;
-------------------------------------------------------------------------------&lt;BR /&gt;
&amp;gt; SOC 145, 215&lt;BR /&gt;
_____________________________________________________ 1 course needed&lt;BR /&gt;
================================================================================&lt;BR /&gt;
N) 8: FRESHMAN EXPERIENCE - 2 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; ASE 101&lt;BR /&gt;
_____________________________________________________ 1 course needed&lt;BR /&gt;
================================================================================&lt;BR /&gt;
C) 9: ELECTIVES - 15 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; ELECTIVE COURSES MAY BE SELECTED FROM THE FOLLOWING AREAS:&lt;BR /&gt;
&amp;gt; - THE EMPHASIS AREA LIST</description>
      <pubDate>Fri, 06 May 2011 19:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62703#M17860</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-05-06T19:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62704#M17861</link>
      <description>As this appears to be sort of an old school printed report...you may have to resort to old school tactics....&lt;BR /&gt;
&lt;BR /&gt;
I'd have to look for indicators of what kind of data you have on a certain row.  I can't tell where the student # is, but if you can map out the exact logic, SAS can parse files like this.  &lt;BR /&gt;
&lt;BR /&gt;
Back in the day..entire software programs were created to parse printed output files.  You had to map the layouts and then the programs would intepret the map.</description>
      <pubDate>Fri, 06 May 2011 21:33:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62704#M17861</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2011-05-06T21:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62705#M17862</link>
      <description>I'm starting to try to parse this and need a few tips on finding text.&lt;BR /&gt;
&lt;BR /&gt;
For example, one piece of data that I need is a line that looks like this:&lt;BR /&gt;
Student............: John Doe  (0012345)&lt;BR /&gt;
&lt;BR /&gt;
The row will always start with the word 'Student' and the value after the first parenthesis will be a length of 7.  All I need is the number inside the parens.&lt;BR /&gt;
&lt;BR /&gt;
data work.audit;&lt;BR /&gt;
infile 'D:\temp\nick_tmp\DA.txt' length=len;&lt;BR /&gt;
input row $varying200. len;&lt;BR /&gt;
IF _infile_ ='' then delete;&lt;BR /&gt;
&lt;BR /&gt;
IF Studentid= indexc(row, '(') then do;&lt;BR /&gt;
input Studentid ;&lt;BR /&gt;
  END&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 09 May 2011 18:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62705#M17862</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-05-09T18:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62706#M17863</link>
      <description>how about:&lt;BR /&gt;
&lt;BR /&gt;
if substr(row,1,8)='Student.' then StudentId=mid(row,index(row,'(')+1,7);</description>
      <pubDate>Mon, 09 May 2011 20:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62706#M17863</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2011-05-09T20:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62707#M17864</link>
      <description>[pre]&lt;BR /&gt;
data temp(keep=studentid where=(studentid is not missing));&lt;BR /&gt;
 infile datalines length=len ;&lt;BR /&gt;
 input row $varying200. len;&lt;BR /&gt;
 if upcase(row) eq: 'STUDENT' then studentid=substr(row,findc(row,'(')+1,7);&lt;BR /&gt;
datalines;&lt;BR /&gt;
Student............: John Doe (0012345)&lt;BR /&gt;
C) 9: ELECTIVES - 15 HOURS REQUIRED&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Tue, 10 May 2011 03:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62707#M17864</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-10T03:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62708#M17865</link>
      <description>Worked great.  I'm working on the last key pieces of data and could use some advice.  The data that I ultimately need is the line that has data like this:&lt;BR /&gt;
MAT-116 COLLEGE ALGEBRA............ 93/FA    C         5 &lt;BR /&gt;
and so on.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
(*) Anticipates completion of in-progress and registered courses&lt;BR /&gt;
================================================================================&lt;BR /&gt;
Statuses: W=Waived, C=Complete, I=In progress, N=Not started&lt;BR /&gt;
P=Pending completion of unfinished activity&lt;BR /&gt;
================================================================================&lt;BR /&gt;
C) 1: ENGLISH COMPOSITION - 9 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; ENG 111, 112, 113&lt;BR /&gt;
Credits: 9&lt;BR /&gt;
ENG-111 ENGLISH COMPOSITION I...... 92/WI    B         3&lt;BR /&gt;
ENG-112 ENGLISH COMPOSITION II..... 92/SP    B         3&lt;BR /&gt;
ENG-113 ENGLISH COMPOSITION III.... 92/FA    B         3&lt;BR /&gt;
================================================================================&lt;BR /&gt;
C) 2: MATHEMATICS/NATURAL &amp;amp; PHYSICAL SCIENCES&lt;BR /&gt;
Credits: 31&lt;BR /&gt;
Complete all 3 subrequirements:&lt;BR /&gt;
C) A: MATHEMATICS&lt;BR /&gt;
&amp;gt; MINIMUM ONE COURSE FROM THE FOLLOWING: MAT 116, 117, 122,&lt;BR /&gt;
&amp;gt; 201, 202, 203, 204, 215, 216 OR 218&lt;BR /&gt;
MAT-116 COLLEGE ALGEBRA............ 93/FA    C         5&lt;BR /&gt;
&lt;BR /&gt;
C) B: SCIENCE SEQUENCE&lt;BR /&gt;
&amp;gt; COMPLETE A MINIMUM OF ONE SEQUENCE WITH LABS:&lt;BR /&gt;
Credits: 12&lt;BR /&gt;
C) BIO 111, 112, 113 WITH LABS&lt;BR /&gt;
Credits: 12&lt;BR /&gt;
BIO-111 GENERAL BIOLOGY I.......... 93/SP    C         4&lt;BR /&gt;
BIO-112 GENERAL BIOLOGY II......... 93/FA    C         4&lt;BR /&gt;
BIO-113 GENERAL BIOLOGY III........ 94/WI    C         4&lt;BR /&gt;
&lt;BR /&gt;
C) C: ADD MATH &amp;amp; SCIENCE&lt;BR /&gt;
&amp;gt; ADDITIONAL HOURS OF MATH AND/OR SCIENCE TO TOTAL 29:&lt;BR /&gt;
04/04/11                        Ayanna A. Archie                       Page 2&lt;BR /&gt;
-------------------------------------------------------------------------------&lt;BR /&gt;
Credits: 14&lt;BR /&gt;
MAT-117 TRIGONOMETRY............... 94/WI    C         4&lt;BR /&gt;
CHE-151 GENERAL CHEMISTRY I........ 94/FA    B         5&lt;BR /&gt;
MAT-201 CALCULUS + ANALY GEOM I.... 94/FA    C         5&lt;BR /&gt;
================================================================================&lt;BR /&gt;
C) 3: SOCIAL &amp;amp; BEHAVIORAL SCIENCES - 15 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; SELECT 15 HOURS FROM AT LEAST TWO SUBJECT AREAS:&lt;BR /&gt;
&amp;gt; ECO 201, 202, 203&lt;BR /&gt;
&amp;gt; GEO 101, 102, 201, 202&lt;BR /&gt;
&amp;gt; PLS 101, 102, 103, 104, 200, 201&lt;BR /&gt;
&amp;gt; PSY 121 AND 122 OR PSY 119&lt;BR /&gt;
&amp;gt; PSY 205 AND/OR 206 - OR PSY 208&lt;BR /&gt;
&amp;gt; PSY 207, 217, 223, 225, 228, 242&lt;BR /&gt;
&amp;gt; SOC 111 AND 112 OR SOC 120&lt;BR /&gt;
&amp;gt; SOC 145, 160, 205, 208, 215, 226&lt;BR /&gt;
Credits: 15&lt;BR /&gt;
PSY-121 GENERAL PSYCHOLOGY I....... 92/WI    C         3&lt;BR /&gt;
PLS-101 AMERICAN FEDERAL GOVT I.... 92/SP    C         3&lt;BR /&gt;
ECO-201 PRIN OF ECONOMICS I........ 92/SP    B         3&lt;BR /&gt;
ECO-202 PRIN OF ECONOMICS II....... 93/WI    C         3&lt;BR /&gt;
PLS-102 AMERICAN FEDERAL GOVT II... 93/WI    B         3&lt;BR /&gt;
================================================================================&lt;BR /&gt;
I) 4: ARTS &amp;amp; HUMANITIES - 15 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; SELECT 15 HOURS FROM AT LEAST TWO SUBJECT AREAS:&lt;BR /&gt;
&amp;gt; ART 101, 102, 125, 231, 232, 233, 235, 236&lt;BR /&gt;
&amp;gt; DAN 155, 157&lt;BR /&gt;
&amp;gt; HIS 101, 102, 103, 105, 111, 112, 113, 214, 215, 216, 217&lt;BR /&gt;
&amp;gt; HUM 125, 130, 131, 255&lt;BR /&gt;
&amp;gt; LIT 201, 202, 203, 211, 212, 213, 217, 227, 230, 234&lt;BR /&gt;
&amp;gt; MUS 115, 131, 132, 133&lt;BR /&gt;
&amp;gt; PHI 204, 205, 206&lt;BR /&gt;
&amp;gt; REL 111, 112, 135, 204&lt;BR /&gt;
&amp;gt; THE 105, 201, 202, 203&lt;BR /&gt;
Credits: 9   Required: 15   Remaining: 6&lt;BR /&gt;
MUS-115 MUSIC APPRECIATION......... 93/WI    B         3&lt;BR /&gt;
HIS-111 WESTERN CIV (0-1300)....... 96/WI    B         3&lt;BR /&gt;
HIS-112 WEST CIV (1300-1815)....... 96/SP    B         3&lt;BR /&gt;
____________________________________________________ 6 credits needed&lt;BR /&gt;
================================================================================&lt;BR /&gt;
C) 5: COMPUTER COMPETENCY - 3 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; TAKE ONE COURSE FROM THE FOLLOWING:&lt;BR /&gt;
&amp;gt; CIS 111, CIS/BIS 119, CIS/BIS/0IS 160&lt;BR /&gt;
&amp;gt; CHE 152&lt;BR /&gt;
&amp;gt; MAT 220&lt;BR /&gt;
CIS-119 PC APPLICATIONS IN BUS..... 92/FA    B         3&lt;BR /&gt;
================================================================================</description>
      <pubDate>Tue, 10 May 2011 18:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62708#M17865</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-05-10T18:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62709#M17866</link>
      <description>You do not post what you want output dataset looks like?&lt;BR /&gt;
If you only want obs start with MIT then use:&lt;BR /&gt;
[pre]&lt;BR /&gt;
if upcase(row) eq: 'MIT' then output;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
to clean data.&lt;BR /&gt;
If you want much more obs different from 'MIT' ,Emmmm there might be to need more code.&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 11 May 2011 01:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62709#M17866</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-11T01:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62710#M17867</link>
      <description>If the data matches this format:&lt;BR /&gt;
&lt;BR /&gt;
BIO-111 GENERAL BIOLOGY I.......... 93/SP C 4&lt;BR /&gt;
BIO-112 GENERAL BIOLOGY II......... 93/FA C 4&lt;BR /&gt;
BIO-113 GENERAL BIOLOGY III........ 94/WI C 4&lt;BR /&gt;
&lt;BR /&gt;
I need a dataset that contains:&lt;BR /&gt;
&lt;BR /&gt;
ID                           Name                        Term                         Status                 credit&lt;BR /&gt;
BIO-111                  General Biology          93/SP                       C                         4</description>
      <pubDate>Wed, 11 May 2011 13:29:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62710#M17867</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-05-11T13:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62711#M17868</link>
      <description>You have the DATA step DO/END with an internal INPUT statement logic, as demonstrated below, given the "data section border" you revealed earlier:&lt;BR /&gt;
&lt;BR /&gt;
* earlier DATA step code omitted. ;&lt;BR /&gt;
DONE=0;&lt;BR /&gt;
DO UNTIL(DONE);&lt;BR /&gt;
  INPUT @;&lt;BR /&gt;
  IF _INFILE_ NE: '======' THEN DO;&lt;BR /&gt;
    * SOME INPUT STATEMENT CODE GOES HERE. ;&lt;BR /&gt;
    * SOME OUTPUT STATEMENT CODE GOES HERE. ;&lt;BR /&gt;
  END;&lt;BR /&gt;
  ELSE DONE=1;&lt;BR /&gt;
END;&lt;BR /&gt;
* later DATA step code omitted. ;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 11 May 2011 15:03:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62711#M17868</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-05-11T15:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62712#M17869</link>
      <description>OK.&lt;BR /&gt;
But not see your whole data, So It is hard to split the row into id name ..... etc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data temp;&lt;BR /&gt;
 infile datalines length=len ;&lt;BR /&gt;
 input row $varying200. len;&lt;BR /&gt;
 if findc(row,'-') gt 1 and findc(row,'-') le 10 and not missing(input(scan(row,2,' -'),?? best10.))&lt;BR /&gt;
    and not missing(input(scan(row,-1,' '),?? best10.)) then output;&lt;BR /&gt;
datalines;&lt;BR /&gt;
(*) Anticipates completion of in-progress and registered courses&lt;BR /&gt;
================================================================================&lt;BR /&gt;
Statuses: W=Waived, C=Complete, I=In progress, N=Not started&lt;BR /&gt;
P=Pending completion of unfinished activity&lt;BR /&gt;
================================================================================&lt;BR /&gt;
C) 1: ENGLISH COMPOSITION - 9 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; ENG 111, 112, 113&lt;BR /&gt;
Credits: 9&lt;BR /&gt;
ENG-111 ENGLISH COMPOSITION I...... 92/WI B 3&lt;BR /&gt;
ENG-112 ENGLISH COMPOSITION II..... 92/SP B 3&lt;BR /&gt;
ENG-113 ENGLISH COMPOSITION III.... 92/FA B 3&lt;BR /&gt;
================================================================================&lt;BR /&gt;
C) 2: MATHEMATICS/NATURAL &amp;amp; PHYSICAL SCIENCES&lt;BR /&gt;
Credits: 31&lt;BR /&gt;
Complete all 3 subrequirements:&lt;BR /&gt;
C) A: MATHEMATICS&lt;BR /&gt;
&amp;gt; MINIMUM ONE COURSE FROM THE FOLLOWING: MAT 116, 117, 122,&lt;BR /&gt;
&amp;gt; 201, 202, 203, 204, 215, 216 OR 218&lt;BR /&gt;
MAT-116 COLLEGE ALGEBRA............ 93/FA C 5&lt;BR /&gt;
&lt;BR /&gt;
C) B: SCIENCE SEQUENCE&lt;BR /&gt;
&amp;gt; COMPLETE A MINIMUM OF ONE SEQUENCE WITH LABS:&lt;BR /&gt;
Credits: 12&lt;BR /&gt;
C) BIO 111, 112, 113 WITH LABS&lt;BR /&gt;
Credits: 12&lt;BR /&gt;
BIO-111 GENERAL BIOLOGY I.......... 93/SP C 4&lt;BR /&gt;
BIO-112 GENERAL BIOLOGY II......... 93/FA C 4&lt;BR /&gt;
BIO-113 GENERAL BIOLOGY III........ 94/WI C 4&lt;BR /&gt;
&lt;BR /&gt;
C) C: ADD MATH &amp;amp; SCIENCE&lt;BR /&gt;
&amp;gt; ADDITIONAL HOURS OF MATH AND/OR SCIENCE TO TOTAL 29:&lt;BR /&gt;
04/04/11 Ayanna A. Archie Page 2&lt;BR /&gt;
-------------------------------------------------------------------------------&lt;BR /&gt;
Credits: 14&lt;BR /&gt;
MAT-117 TRIGONOMETRY............... 94/WI C 4&lt;BR /&gt;
CHE-151 GENERAL CHEMISTRY I........ 94/FA B 5&lt;BR /&gt;
MAT-201 CALCULUS + ANALY GEOM I.... 94/FA C 5&lt;BR /&gt;
================================================================================&lt;BR /&gt;
C) 3: SOCIAL &amp;amp; BEHAVIORAL SCIENCES - 15 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; SELECT 15 HOURS FROM AT LEAST TWO SUBJECT AREAS:&lt;BR /&gt;
&amp;gt; ECO 201, 202, 203&lt;BR /&gt;
&amp;gt; GEO 101, 102, 201, 202&lt;BR /&gt;
&amp;gt; PLS 101, 102, 103, 104, 200, 201&lt;BR /&gt;
&amp;gt; PSY 121 AND 122 OR PSY 119&lt;BR /&gt;
&amp;gt; PSY 205 AND/OR 206 - OR PSY 208&lt;BR /&gt;
&amp;gt; PSY 207, 217, 223, 225, 228, 242&lt;BR /&gt;
&amp;gt; SOC 111 AND 112 OR SOC 120&lt;BR /&gt;
&amp;gt; SOC 145, 160, 205, 208, 215, 226&lt;BR /&gt;
Credits: 15&lt;BR /&gt;
PSY-121 GENERAL PSYCHOLOGY I....... 92/WI C 3&lt;BR /&gt;
PLS-101 AMERICAN FEDERAL GOVT I.... 92/SP C 3&lt;BR /&gt;
ECO-201 PRIN OF ECONOMICS I........ 92/SP B 3&lt;BR /&gt;
ECO-202 PRIN OF ECONOMICS II....... 93/WI C 3&lt;BR /&gt;
PLS-102 AMERICAN FEDERAL GOVT II... 93/WI B 3&lt;BR /&gt;
================================================================================&lt;BR /&gt;
I) 4: ARTS &amp;amp; HUMANITIES - 15 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; SELECT 15 HOURS FROM AT LEAST TWO SUBJECT AREAS:&lt;BR /&gt;
&amp;gt; ART 101, 102, 125, 231, 232, 233, 235, 236&lt;BR /&gt;
&amp;gt; DAN 155, 157&lt;BR /&gt;
&amp;gt; HIS 101, 102, 103, 105, 111, 112, 113, 214, 215, 216, 217&lt;BR /&gt;
&amp;gt; HUM 125, 130, 131, 255&lt;BR /&gt;
&amp;gt; LIT 201, 202, 203, 211, 212, 213, 217, 227, 230, 234&lt;BR /&gt;
&amp;gt; MUS 115, 131, 132, 133&lt;BR /&gt;
&amp;gt; PHI 204, 205, 206&lt;BR /&gt;
&amp;gt; REL 111, 112, 135, 204&lt;BR /&gt;
&amp;gt; THE 105, 201, 202, 203&lt;BR /&gt;
Credits: 9 Required: 15 Remaining: 6&lt;BR /&gt;
MUS-115 MUSIC APPRECIATION......... 93/WI B 3&lt;BR /&gt;
HIS-111 WESTERN CIV (0-1300)....... 96/WI B 3&lt;BR /&gt;
HIS-112 WEST CIV (1300-1815)....... 96/SP B 3&lt;BR /&gt;
____________________________________________________ 6 credits needed&lt;BR /&gt;
================================================================================&lt;BR /&gt;
C) 5: COMPUTER COMPETENCY - 3 HOURS REQUIRED&lt;BR /&gt;
&amp;gt; TAKE ONE COURSE FROM THE FOLLOWING:&lt;BR /&gt;
&amp;gt; CIS 111, CIS/BIS 119, CIS/BIS/0IS 160&lt;BR /&gt;
&amp;gt; CHE 152&lt;BR /&gt;
&amp;gt; MAT 220&lt;BR /&gt;
CIS-119 PC APPLICATIONS IN BUS..... 92/FA B 3&lt;BR /&gt;
================================================================================ &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 12 May 2011 04:56:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62712#M17869</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-12T04:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62713#M17870</link>
      <description>&amp;gt; I'm starting to try to parse this and need a few tips&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; For example, one piece of data that I need is a line&lt;BR /&gt;
&amp;gt; Student............: John Doe  (0012345)&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; The row will always start with the word 'Student' and&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; length of 7.  All I need is the number inside the&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
data work.audit;&lt;BR /&gt;
  infile 'D:\temp\nick_tmp\DA.txt' dlm=' )' length=len;&lt;BR /&gt;
 /* add  ) to valid delimiters (will lose it with simple input */&lt;BR /&gt;
  input starting :$20. @1 @  ;&lt;BR /&gt;
 IF _infile_ ='' then delete;&lt;BR /&gt;
  if starting =: 'Student' then input @'(' StudentID @1 @ ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
or &lt;BR /&gt;
data work.audit;&lt;BR /&gt;
  infile 'D:\temp\nick_tmp\DA.txt' dlm=' )' ;&lt;BR /&gt;
  input @'Student'  @'(' StudentID @1 @ ;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 12 May 2011 15:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62713#M17870</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-05-12T15:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62714#M17871</link>
      <description>Thanks everyone for all the help.  I have everything parsed except for 1 more item.&lt;BR /&gt;
&lt;BR /&gt;
from file:  HIS-103 U.S. HIST (1919-PRESENT)... 08/FA    B         3&lt;BR /&gt;
&lt;BR /&gt;
I need this:  U.S. HIST (1919-PRESENT)&lt;BR /&gt;
&lt;BR /&gt;
I know the starting position but with this example the course name has periods in it and that through off my approach using substr and findc to find the first occurence of '..' and -1 as the end point.  My new approach is to use REVERSE but it isn't working out.&lt;BR /&gt;
&lt;BR /&gt;
IF index(row, '-')=14 and index(row, '*')=0 then &lt;BR /&gt;
    do&lt;BR /&gt;
      revrow=reverse(trim(row));&lt;BR /&gt;
      Course_Description = substr(revrow,findc(revrow, '..')+1, findc(revrow, '-')-5);&lt;BR /&gt;
      c=reverse(trim(course_description));&lt;BR /&gt;
      &lt;BR /&gt;
      *Course_Description=substr(row,Course_Desc_Start,(Course_Desc_End - Course_Desc_Start));&lt;BR /&gt;
    end;</description>
      <pubDate>Tue, 17 May 2011 18:21:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62714#M17871</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-05-17T18:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62715#M17872</link>
      <description>How about:&lt;BR /&gt;
course=substr( scan(row,')',1),findc(scan(row,')',1),' '))||')' ;&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 18 May 2011 02:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62715#M17872</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-18T02:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: reading fixed formatted file where rows repeat</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62716#M17873</link>
      <description>All this returned was a right parenthesis.&lt;BR /&gt;
&lt;BR /&gt;
Also, there may be many possibilities to the course information.&lt;BR /&gt;
&lt;BR /&gt;
ECE-101 INTRO TO ECE............... 10/FA    A         3&lt;BR /&gt;
ECE-106 CHLDHD NUTR/HLTH/SFTY...... 10/WI    A         3&lt;BR /&gt;
ENG-111 ENGLISH COMPOSITION I...... 10/WI    B         3&lt;BR /&gt;
SOC-111 GENERAL SOCIOLOGY I........ 10/FA    A         3&lt;BR /&gt;
&lt;BR /&gt;
and so on.  My goal is to just get course description information.

Message was edited by: nickb</description>
      <pubDate>Wed, 18 May 2011 13:13:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-fixed-formatted-file-where-rows-repeat/m-p/62716#M17873</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2011-05-18T13:13:35Z</dc:date>
    </item>
  </channel>
</rss>

