<?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 use SAS column input with tabs and spaces for simple data set? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852027#M37427</link>
    <description>&lt;P&gt;One option might be to use tab as a delimiter. But I can't tell from your posted data whether that makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the presence of tabs means "column x" is not really very viable as program settings determine how wide a tab would be displayed. With fixed column input, such as you seem to have attempted, a single tab character is&amp;nbsp; just that, one character. So if the 4th character encountered is a tab then the input would read that tab character as part of the value. You could remove them using COMPRESS function in that case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When it comes to tabs you may have to attach a text file with the values as dealing with such in this forum and/or editors (I have tabs replaced by spaces for instance) gets a bit complicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Didn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the "&amp;lt;/&amp;gt;" to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data, normally I would say in the form of a data step. In this case that is part of the issue and an example text file attachment might be a better approach just to be sure that the forum software isn't moving anything.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2023 21:01:35 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-01-03T21:01:35Z</dc:date>
    <item>
      <title>How to use SAS column input with tabs and spaces for simple data set?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852018#M37426</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do you read in only the positions of characters you want if the dataset has tabs, spaces?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data colINPUT;
  length x $10;
  input x $ 3-11;
datalines;
1  abcdefgh  tab spaces something 12345
 aabc                 sf dss
  thirdrecord
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How do I create a data from column 3 to column 11 only? So with the sample above, the output dataset should be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;abcdefgh&lt;/P&gt;&lt;P&gt;abc&lt;/P&gt;&lt;P&gt;thirdreco&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code didn't work.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 20:02:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852018#M37426</guid>
      <dc:creator>cosmid</dc:creator>
      <dc:date>2023-01-03T20:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SAS column input with tabs and spaces for simple data set?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852027#M37427</link>
      <description>&lt;P&gt;One option might be to use tab as a delimiter. But I can't tell from your posted data whether that makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the presence of tabs means "column x" is not really very viable as program settings determine how wide a tab would be displayed. With fixed column input, such as you seem to have attempted, a single tab character is&amp;nbsp; just that, one character. So if the 4th character encountered is a tab then the input would read that tab character as part of the value. You could remove them using COMPRESS function in that case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When it comes to tabs you may have to attach a text file with the values as dealing with such in this forum and/or editors (I have tabs replaced by spaces for instance) gets a bit complicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Didn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the "&amp;lt;/&amp;gt;" to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data, normally I would say in the form of a data step. In this case that is part of the issue and an example text file attachment might be a better approach just to be sure that the forum software isn't moving anything.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 21:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852027#M37427</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-03T21:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SAS column input with tabs and spaces for simple data set?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852037#M37428</link>
      <description>Hi ballardw, looking back at my question, it didn't make sense to me. Thanks for pointing that out.</description>
      <pubDate>Tue, 03 Jan 2023 22:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852037#M37428</guid>
      <dc:creator>cosmid</dc:creator>
      <dc:date>2023-01-03T22:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SAS column input with tabs and spaces for simple data set?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852127#M37435</link>
      <description>&lt;P&gt;If someone has accidentally replaced spaces with tabs in your data file (some editors used to do that to save disk space) then perhaps all you need to do is use the EXPANDTABS option on the INFILE statement.&amp;nbsp; That will replace any tab characters in the data with the right number of spaces to move to the next tab stop.&amp;nbsp; In that case the tab stops are the "normal" every 8 spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;925  filename test temp;
926  data _null_;
927    file test;
928    put '123' '09'x '9.1' '09'x '789';
929  run;

NOTE: The file TEST is:
      (system-specific pathname),
      (system-specific file attributes)

NOTE: 1 record was written to the file (system-specific pathname).
      The minimum record length was 11.
      The maximum record length was 11.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


930
931  data _null_;
932    infile test;
933    input;
934    list;
935  run;

NOTE: The infile TEST is:
      (system-specific pathname),
      (system-specific file attributes)

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0

1   CHAR  123.9.1.789 11
    ZONE  33303230333
    NUMR  12399E19789
NOTE: 1 record was read from the infile (system-specific pathname).
      The minimum record length was 11.
      The maximum record length was 11.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


936
937  data _null_;
938    infile test expandtabs;
939    input;
940    list;
941  run;

NOTE: The infile TEST is:
      (system-specific pathname),
      (system-specific file attributes)

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
1         123     9.1     789 19
NOTE: 1 record was read from the infile (system-specific pathname).
      The minimum record length was 11.
      The maximum record length was 11.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jan 2023 15:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852127#M37435</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-04T15:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use SAS column input with tabs and spaces for simple data set?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852130#M37436</link>
      <description>This expandtabs feature is very good to know. Thank you!&lt;BR /&gt;&lt;BR /&gt;Also, I realized what my issue was and I had asked the wrong question. I had a word document with few columns and I am only interested in one of the column values. When I copy and paste from word document to UNIX SAS, the output included multiple columns, but when I paste them into SAS Windows, the output had the correct result. That's when I realized SAS UNIX and SAS Windows treats tabs differently. But this expandtabs is going to help in the future I am sure of it. I am going to spend a bit time to study it more. Thanks again for the info!</description>
      <pubDate>Wed, 04 Jan 2023 16:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-SAS-column-input-with-tabs-and-spaces-for-simple-data/m-p/852130#M37436</guid>
      <dc:creator>cosmid</dc:creator>
      <dc:date>2023-01-04T16:02:27Z</dc:date>
    </item>
  </channel>
</rss>

