<?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 in a file from specific rows in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16574#M3059</link>
    <description>You could use if = _n_ 4 then... to assign your master date. Have this column in a retain statement.&lt;BR /&gt;
&lt;BR /&gt;
To check whether a date is valid you could just input there value using appropriate date format. &lt;BR /&gt;
Testing the other data depends on what is valid data. Non-missing? Using (subsetting) if statments seems to be the most straightforward way to do it.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
    <pubDate>Thu, 06 May 2010 11:20:11 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2010-05-06T11:20:11Z</dc:date>
    <item>
      <title>reading in a file from specific rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16573#M3058</link>
      <description>I have a tab delimited file and basically I want to read row 4 (date value) and put it into a column.  I also want to read only rows that have a valid time and data.  Below is an example of the file and program:&lt;BR /&gt;
&lt;BR /&gt;
# ----------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
Visits for all visitors&lt;BR /&gt;
April 23, 2010	April 23, 2010  ********want this in a column&lt;BR /&gt;
# ----------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
# ----------------------------------------&lt;BR /&gt;
# Graph&lt;BR /&gt;
# ----------------------------------------&lt;BR /&gt;
Hour 	All Visits (Segment)	Traffic (Segment)	Traffic (Segment)&lt;BR /&gt;
00:00:00	492	0	492&lt;BR /&gt;
01:00:00	259	0	259&lt;BR /&gt;
02:00:00	130	0	130&lt;BR /&gt;
03:00:00	100	0	100&lt;BR /&gt;
04:00:00	66	0	66&lt;BR /&gt;
05:00:00	99	0	99&lt;BR /&gt;
06:00:00	242	6	236&lt;BR /&gt;
07:00:00	597	80	517&lt;BR /&gt;
08:00:00	1,106	268	838&lt;BR /&gt;
09:00:00	1,421	383	1,038&lt;BR /&gt;
10:00:00	1,518	438	1,080&lt;BR /&gt;
11:00:00	1,524	419	1,105&lt;BR /&gt;
12:00:00	1,436	321	1,115&lt;BR /&gt;
13:00:00	1,385	243	1,142&lt;BR /&gt;
14:00:00	1,252	158	1,094&lt;BR /&gt;
15:00:00	1,299	142	1,157&lt;BR /&gt;
16:00:00	1,178	87	1,091&lt;BR /&gt;
17:00:00	1,025	16	1,009&lt;BR /&gt;
18:00:00	928	7	921&lt;BR /&gt;
19:00:00	971	3	968&lt;BR /&gt;
20:00:00	992	3	989&lt;BR /&gt;
21:00:00	998	3	995&lt;BR /&gt;
22:00:00	933	0	933&lt;BR /&gt;
23:00:00	731	0	731&lt;BR /&gt;
# --------------------------------------------------------------------------------  causing issues in log&lt;BR /&gt;
&lt;BR /&gt;
data va;&lt;BR /&gt;
	infile 'D:\Temp\test1.csv' dlm='09'x FIRSTOBS=11;&lt;BR /&gt;
	INPUT Time $  Visits $ CampusTraffic $ OffCampusTraffic $ ;</description>
      <pubDate>Wed, 05 May 2010 20:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16573#M3058</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2010-05-05T20:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: reading in a file from specific rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16574#M3059</link>
      <description>You could use if = _n_ 4 then... to assign your master date. Have this column in a retain statement.&lt;BR /&gt;
&lt;BR /&gt;
To check whether a date is valid you could just input there value using appropriate date format. &lt;BR /&gt;
Testing the other data depends on what is valid data. Non-missing? Using (subsetting) if statments seems to be the most straightforward way to do it.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Thu, 06 May 2010 11:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16574#M3059</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2010-05-06T11:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: reading in a file from specific rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16575#M3060</link>
      <description>remove that firstobs=[pre]data va;&lt;BR /&gt;
   infile 'D:\Temp\test1.csv' dlm='09'x  truncover ;&lt;BR /&gt;
   retain visitor_date '12345678901234567890'  ;&lt;BR /&gt;
   if visitor_date =:'1234567890' then do ;&lt;BR /&gt;
      input @'Visits' ;&lt;BR /&gt;
      input ;&lt;BR /&gt;
      visit_date = _infile_ ;&lt;BR /&gt;
      delete;&lt;BR /&gt;
   end ;&lt;BR /&gt;
   input hour ? @ ;&lt;BR /&gt;
   if _error_ then do;&lt;BR /&gt;
      _error_ = 0 ;&lt;BR /&gt;
      delete ;&lt;BR /&gt;
   end ;&lt;BR /&gt;
   input allv trafS1 trafs2 ;&lt;BR /&gt;
   label allv='All Visits' trafs1= 'Campus Traffic' trafs2='Off-Campus Traffic' ;&lt;BR /&gt;
   format hour hhmm. ;&lt;BR /&gt;
   informat hour time8. allv trafs: comma14. ; &lt;BR /&gt;
run ;[/pre]&lt;BR /&gt;
good luck&lt;BR /&gt;
PeterC</description>
      <pubDate>Thu, 06 May 2010 11:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16575#M3060</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-05-06T11:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: reading in a file from specific rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16576#M3061</link>
      <description>My code is :&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data temp;&lt;BR /&gt;
  if _n_ =1 then do; &lt;BR /&gt;
                  input @'visitors' / date $14. @'(Segment)' / Time $ Visits $ CampusTraffic $ OffCampusTraffic $ ;&lt;BR /&gt;
                  output;&lt;BR /&gt;
				  end;&lt;BR /&gt;
 &lt;BR /&gt;
   input Time $ Visits $ CampusTraffic $ OffCampusTraffic $ ; &lt;BR /&gt;
   if Time ne '#' then output;&lt;BR /&gt;
   retain date;&lt;BR /&gt;
datalines;&lt;BR /&gt;
# ----------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
Visits for all visitors&lt;BR /&gt;
April 23, 2010 April 23, 2010 ********want this in a column&lt;BR /&gt;
# ----------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
# ----------------------------------------&lt;BR /&gt;
# Graph&lt;BR /&gt;
# ----------------------------------------&lt;BR /&gt;
Hour All Visits (Segment) Traffic (Segment) Traffic (Segment)&lt;BR /&gt;
00:00:00 492 0 492&lt;BR /&gt;
01:00:00 259 0 259&lt;BR /&gt;
02:00:00 130 0 130&lt;BR /&gt;
03:00:00 100 0 100&lt;BR /&gt;
04:00:00 66 0 66&lt;BR /&gt;
05:00:00 99 0 99&lt;BR /&gt;
06:00:00 242 6 236&lt;BR /&gt;
07:00:00 597 80 517&lt;BR /&gt;
08:00:00 1,106 268 838&lt;BR /&gt;
09:00:00 1,421 383 1,038&lt;BR /&gt;
10:00:00 1,518 438 1,080&lt;BR /&gt;
11:00:00 1,524 419 1,105&lt;BR /&gt;
12:00:00 1,436 321 1,115&lt;BR /&gt;
13:00:00 1,385 243 1,142&lt;BR /&gt;
14:00:00 1,252 158 1,094&lt;BR /&gt;
15:00:00 1,299 142 1,157&lt;BR /&gt;
16:00:00 1,178 87 1,091&lt;BR /&gt;
17:00:00 1,025 16 1,009&lt;BR /&gt;
18:00:00 928 7 921&lt;BR /&gt;
19:00:00 971 3 968&lt;BR /&gt;
20:00:00 992 3 989&lt;BR /&gt;
21:00:00 998 3 995&lt;BR /&gt;
22:00:00 933 0 933&lt;BR /&gt;
23:00:00 731 0 731&lt;BR /&gt;
# -------------------------------------------------------------------------------- causing issues in log&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Under SAS 9.0 version , code is OK.

Message was edited by: Ksharp</description>
      <pubDate>Thu, 06 May 2010 13:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16576#M3061</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-05-06T13:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: reading in a file from specific rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16577#M3062</link>
      <description>When I run this I get 6 variables but no observations.</description>
      <pubDate>Thu, 06 May 2010 13:39:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16577#M3062</guid>
      <dc:creator>nickb</dc:creator>
      <dc:date>2010-05-06T13:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: reading in a file from specific rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16578#M3063</link>
      <description>Recommend some self-initiated desk-checking using a PUTLOG statement, as shown below -- you might consider placing multiples of these in various points in your program to display variables as the processing continues (increment "nn" value for identification with each being unique":&lt;BR /&gt;
&lt;BR /&gt;
PUTLOG '&amp;gt;DIAG-nn&amp;gt;' / _all_;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Suggest you share your SAS log back with a post/reply to the forum for additional guidance, if needed further after the desk-checking exercise.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 07 May 2010 00:48:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-in-a-file-from-specific-rows/m-p/16578#M3063</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-05-07T00:48:10Z</dc:date>
    </item>
  </channel>
</rss>

