<?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: How to read multiple lines as one observation in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-multiple-lines-as-one-observation/m-p/609827#M17977</link>
    <description>&lt;P&gt;First, your data step does not run as posted. The column assignments don't match the data actual positions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, you should show something about what you expect the output to look like.&lt;/P&gt;
&lt;P&gt;I'm not quite sure exactly what you expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc print expects to output tabular data with one observation per line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to assume you are actually reading from an external text file. This modified data step may work a bit better&lt;/P&gt;
&lt;PRE&gt;data hw7;
infile datalines truncover;
input 
   coursename $1-4 section 5 ID 6-7 Name $9-16 
   / a b  c  d  e   f  / g  h  i  j  k  l ;
datalines;
M100101 Armann
10 10 10 10 8  9
13 15 10
M100102 Ellery
8 10 7  6 10 1
7 12 15
M100103 Anna
7  5 10 4  10 10
12 9 11
M100104 Tomo
9 8 10 5  10 5
10 14 12
M100301 Glenn
9 6 11 13
2 4 6 5 9 10 10 
M100302 Duc
14 12 10 12
9 10 10 8 10 10 10
M100303 Woo
14 15 12 9
8 7 9 10 5 9 10
M100304 Olson
10 10 12 11
5 10 7 9 8 10 10 
M100305 Ma
12 15 14 10
10 10 10 10 9 10 9
M100306 Garcia
14 13 15 11
9 10 8 10 10 6 10
;
run;
&lt;/PRE&gt;
&lt;P&gt;the / in the Input statement basically says "continued on next line" and as long as all of your records have all three lines things will be fine for reading.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Dec 2019 00:04:33 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-12-06T00:04:33Z</dc:date>
    <item>
      <title>How to read multiple lines as one observation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-multiple-lines-as-one-observation/m-p/609823#M17976</link>
      <description>&lt;P&gt;Hello! I have a data set that I need separated into 10 observations. The data has 3 lines for each observation. part of my assignment is to separate observations by the section which is column 5 on the first line. The second two lines are HW and quiz scores. I would like to have SAS read everything as one big table, because from there I am fairly comfortable dividing the data up after that. Ive tried many things, but this is the closest Ive got:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data hw7;

input coursename $1-4 section 5 ID 6-7 Name $9-16 #5 a 1-3 b 4-6 c 7-9 d 10-12 e 13-15 f #6 16-18 g 1-3 h 4-6 i 7-9 j 10-12 k 13-15 l 16-18;
*input coursename $1-4 section 5@;
datalines;
M100101 Armann
10 10 10 10 8 9
13 15 10
M100102 Ellery
8 10 7 6 10 1
7 12 15
M100103 Anna
7 5 10 4 10 10
12 9 11
M100104 Tomo
9 8 10 5 10 5
10 14 12
M100301 Glenn
9 6 11 13
2 4 6 5 9 10 10 
M100302 Duc
14 12 10 12
9 10 10 8 10 10 10
M100303 Woo
14 15 12 9
8 7 9 10 5 9 10
M100304 Olson
10 10 12 11
5 10 7 9 8 10 10 
M100305 Ma
12 15 14 10
10 10 10 10 9 10 9
M100306 Garcia
14 13 15 11
9 10 8 10 10 6 10
;
run;
proc print;
title 'SAD FACE :(';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;At least SAS knows I have 10 observations now, but I would like sas to print line 2 as a, b, c, d, e, f and line 3 as g, h, i, j , k, l on one observation line in the final output. Please help!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 23:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-multiple-lines-as-one-observation/m-p/609823#M17976</guid>
      <dc:creator>valarievil</dc:creator>
      <dc:date>2019-12-05T23:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to read multiple lines as one observation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-multiple-lines-as-one-observation/m-p/609827#M17977</link>
      <description>&lt;P&gt;First, your data step does not run as posted. The column assignments don't match the data actual positions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, you should show something about what you expect the output to look like.&lt;/P&gt;
&lt;P&gt;I'm not quite sure exactly what you expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc print expects to output tabular data with one observation per line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to assume you are actually reading from an external text file. This modified data step may work a bit better&lt;/P&gt;
&lt;PRE&gt;data hw7;
infile datalines truncover;
input 
   coursename $1-4 section 5 ID 6-7 Name $9-16 
   / a b  c  d  e   f  / g  h  i  j  k  l ;
datalines;
M100101 Armann
10 10 10 10 8  9
13 15 10
M100102 Ellery
8 10 7  6 10 1
7 12 15
M100103 Anna
7  5 10 4  10 10
12 9 11
M100104 Tomo
9 8 10 5  10 5
10 14 12
M100301 Glenn
9 6 11 13
2 4 6 5 9 10 10 
M100302 Duc
14 12 10 12
9 10 10 8 10 10 10
M100303 Woo
14 15 12 9
8 7 9 10 5 9 10
M100304 Olson
10 10 12 11
5 10 7 9 8 10 10 
M100305 Ma
12 15 14 10
10 10 10 10 9 10 9
M100306 Garcia
14 13 15 11
9 10 8 10 10 6 10
;
run;
&lt;/PRE&gt;
&lt;P&gt;the / in the Input statement basically says "continued on next line" and as long as all of your records have all three lines things will be fine for reading.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 00:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-multiple-lines-as-one-observation/m-p/609827#M17977</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-06T00:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to read multiple lines as one observation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-multiple-lines-as-one-observation/m-p/609829#M17978</link>
      <description>&lt;P&gt;AHHH! that / is the command I was looking for. I wonder why nothing came up when I searched for "how to tell SAS to start reading from the next line"... oh well thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 00:09:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-multiple-lines-as-one-observation/m-p/609829#M17978</guid>
      <dc:creator>valarievil</dc:creator>
      <dc:date>2019-12-06T00:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to read multiple lines as one observation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-read-multiple-lines-as-one-observation/m-p/610005#M18019</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294895"&gt;@valarievil&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;AHHH! that / is the command I was looking for. I wonder why nothing came up when I searched for "how to tell SAS to start reading from the next line"... oh well thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The INPUT statement has a lot of options and that results in sub-sets in the documentation for LIST, Named, Formatted and Column methods of reading data plus combinations. So it takes awhile to navigate all the documentation. The / documentation occurs just after the # in the base INPUT documentation though it may not be obvious what "advances the pointer to column 1 of the next input record" might mean.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once upon a time your # (line input indicator) wouldn't even work unless you specifically provided an option on the INFILE statement to indicate how many rows of a source file were to be available to read from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The real fun part comes when you have files that have a key value that indicates that you need to pull a value from a prior row of data and are using the Line (#) indicators with a calculated value.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2019 16:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-read-multiple-lines-as-one-observation/m-p/610005#M18019</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-06T16:07:27Z</dc:date>
    </item>
  </channel>
</rss>

