<?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 more data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356323#M83553</link>
    <description>&lt;P&gt;This might display better, this is what I got.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Output&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WIDEPE" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;subjectnumberstr&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;visitmnemonic&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;pegenap_c&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;peheent_c&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1204&lt;/TD&gt;
&lt;TD class="l data"&gt;screening&lt;/TD&gt;
&lt;TD class="l data"&gt;Abnormal,&lt;/TD&gt;
&lt;TD class="l data"&gt;please&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1204&lt;/TD&gt;
&lt;TD class="l data"&gt;eos/et&lt;/TD&gt;
&lt;TD class="l data"&gt;Normal&lt;/TD&gt;
&lt;TD class="l data"&gt;normal&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1205&lt;/TD&gt;
&lt;TD class="l data"&gt;Screening&lt;/TD&gt;
&lt;TD class="l data"&gt;Normal&lt;/TD&gt;
&lt;TD class="l data"&gt;normal&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1205&lt;/TD&gt;
&lt;TD class="l data"&gt;EOS/ET&lt;/TD&gt;
&lt;TD class="l data"&gt;Normal&lt;/TD&gt;
&lt;TD class="l data"&gt;Abnormal,&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Fri, 05 May 2017 11:15:24 GMT</pubDate>
    <dc:creator>cj9000</dc:creator>
    <dc:date>2017-05-05T11:15:24Z</dc:date>
    <item>
      <title>reading in more data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356235#M83519</link>
      <description>&lt;P&gt;HI again.&lt;/P&gt;
&lt;P&gt;I added another column and data and formatted the input statement as instructed. It seems to have blown up though. Here's the code: Thanks in advance:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data widepe ;&lt;BR /&gt; input subjectnumberstr: $9. visitmnemonic: $9. pegenap_c: &amp;amp; $24. peheent_c: &amp;amp; $24.;&lt;BR /&gt; datalines;&lt;BR /&gt;0100-1204 screening Abnormal, please specify Abnormal, please specify&lt;BR /&gt;0100-1204 eos/et Normal normal&lt;BR /&gt;0100-1205 Screening Normal normal&lt;BR /&gt;0100-1205 EOS/ET Normal Abnormal, please specify&lt;BR /&gt; ;&lt;BR /&gt;run;&lt;BR /&gt;proc print data = widepe; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Output&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WIDEPE" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;subjectnumberstr&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;visitmnemonic&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;pegenap_c&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;peheent_c&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1204&lt;/TD&gt;
&lt;TD class="l data"&gt;screening&lt;/TD&gt;
&lt;TD class="l data"&gt;Abnormal, please specify&lt;/TD&gt;
&lt;TD class="l data"&gt;0100-1204 eos/et Normal&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1205&lt;/TD&gt;
&lt;TD class="l data"&gt;Screening&lt;/TD&gt;
&lt;TD class="l data"&gt;Normal normal&lt;/TD&gt;
&lt;TD class="l data"&gt;0100-1205 EOS/ET Normal&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 May 2017 06:08:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356235#M83519</guid>
      <dc:creator>cj9000</dc:creator>
      <dc:date>2017-05-05T06:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: reading in more data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356242#M83522</link>
      <description>&lt;P&gt;Remove the ampersands.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data widepe ;
input subjectnumberstr: $9. visitmnemonic: $9. pegenap_c:  $24. peheent_c:  $24.;
datalines;
0100-1204 screening Abnormal, please specify Abnormal, please specify
0100-1204 eos/et Normal normal
0100-1205 Screening Normal normal
0100-1205 EOS/ET Normal Abnormal, please specify
;
run;
proc print data = widepe; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;works.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 06:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356242#M83522</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-05T06:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: reading in more data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356321#M83552</link>
      <description>Hmmm Thanks Kurt but when i ran the code I got:&lt;BR /&gt;&lt;BR /&gt;Obs subjectnumberstr visitmnemonic pegenap_c peheent_c&lt;BR /&gt;1 0100-1204 screening Abnormal, please&lt;BR /&gt;2 0100-1204 eos/et Normal normal&lt;BR /&gt;3 0100-1205 Screening Normal normal&lt;BR /&gt;4 0100-1205 EOS/ET Normal Abnormal,&lt;BR /&gt;So then i tried increasing the lengths of the last two variables but got&lt;BR /&gt;the same results&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Fri, 05 May 2017 11:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356321#M83552</guid>
      <dc:creator>cj9000</dc:creator>
      <dc:date>2017-05-05T11:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: reading in more data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356323#M83553</link>
      <description>&lt;P&gt;This might display better, this is what I got.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Output&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WIDEPE" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;subjectnumberstr&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;visitmnemonic&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;pegenap_c&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;peheent_c&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1204&lt;/TD&gt;
&lt;TD class="l data"&gt;screening&lt;/TD&gt;
&lt;TD class="l data"&gt;Abnormal,&lt;/TD&gt;
&lt;TD class="l data"&gt;please&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1204&lt;/TD&gt;
&lt;TD class="l data"&gt;eos/et&lt;/TD&gt;
&lt;TD class="l data"&gt;Normal&lt;/TD&gt;
&lt;TD class="l data"&gt;normal&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1205&lt;/TD&gt;
&lt;TD class="l data"&gt;Screening&lt;/TD&gt;
&lt;TD class="l data"&gt;Normal&lt;/TD&gt;
&lt;TD class="l data"&gt;normal&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="l data"&gt;0100-1205&lt;/TD&gt;
&lt;TD class="l data"&gt;EOS/ET&lt;/TD&gt;
&lt;TD class="l data"&gt;Normal&lt;/TD&gt;
&lt;TD class="l data"&gt;Abnormal,&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 May 2017 11:15:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356323#M83553</guid>
      <dc:creator>cj9000</dc:creator>
      <dc:date>2017-05-05T11:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: reading in more data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356327#M83554</link>
      <description>&lt;P&gt;Oh, totally missed the blanks in the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To read variable length strings that contain blanks, you need either a delimiter in the input data, or you have to enclose the strings in quotes. Then you can use the dsd option:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data widepe;
infile cards dlm="|" truncover;
input subjectnumberstr: $9. visitmnemonic: $9. pegenap_c:  $24. peheent_c:  $24.;
datalines;
0100-1204|screening|Abnormal, please specify|Abnormal, please specify
0100-1204|eos/et|Normal|normal
0100-1205|Screening|Normal|normal
0100-1205|EOS/ET|Normal|Abnormal, please specify
;
run;

proc print data=widepe noobs;
run;

data widepe;
infile cards dlm=" " dsd truncover;
input subjectnumberstr: $9. visitmnemonic: $9. pegenap_c:  $24. peheent_c:  $24.;
datalines;
0100-1204 "screening" "Abnormal, please specify" "Abnormal, please specify"
0100-1204 "eos/et" "Normal" "normal"
0100-1205 "Screening" "Normal" "normal"
0100-1205 "EOS/ET" "Normal" "Abnormal, please specify"
;
run;

proc print data=widepe noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;subjectnumberstr    visitmnemonic    pegenap_c                   peheent_c

   0100-1204          screening      Abnormal, please specify    Abnormal, please specify
   0100-1204          eos/et         Normal                      normal                  
   0100-1205          Screening      Normal                      normal                  
   0100-1205          EOS/ET         Normal                      Abnormal, please specify

subjectnumberstr    visitmnemonic    pegenap_c                   peheent_c

   0100-1204          screening      Abnormal, please specify    Abnormal, please specify
   0100-1204          eos/et         Normal                      normal                  
   0100-1205          Screening      Normal                      normal                  
   0100-1205          EOS/ET         Normal                      Abnormal, please specify
&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 May 2017 11:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356327#M83554</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-05T11:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: reading in more data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356332#M83556</link>
      <description>&lt;P&gt;Thank you Kurt for the solution, it works great. But I thought the ampersand modifier allowed for sas to read blanks within the variable length but I guess not.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 11:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356332#M83556</guid>
      <dc:creator>cj9000</dc:creator>
      <dc:date>2017-05-05T11:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: reading in more data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356333#M83557</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/9970"&gt;@cj9000&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you Kurt for the solution, it works great. But I thought the ampersand modifier allowed for sas to read blanks within the variable length but I guess not.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You are referring to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 class="xis-argument"&gt;&amp;amp;&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;indicates that a character value can have one or more single embedded blanks. This format modifier reads the value from the next non-blank column until the pointer reaches &lt;U&gt;two consecutive blanks&lt;/U&gt;, the defined length of the variable, or the end of the input line, whichever comes first.&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;(underline by me)&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xis-paraSimpleFirst"&gt;For that to work, you would have needed two blanks in succession as delimiters.&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 May 2017 11:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356333#M83557</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-05T11:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: reading in more data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356340#M83560</link>
      <description>&lt;P&gt;Oh I see. Okay well thank you Kurt.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 12:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-in-more-data/m-p/356340#M83560</guid>
      <dc:creator>cj9000</dc:creator>
      <dc:date>2017-05-05T12:03:43Z</dc:date>
    </item>
  </channel>
</rss>

