<?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: Read in hyphen in SAS in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Read-in-hyphen-in-SAS/m-p/580433#M7818</link>
    <description>&lt;P&gt;You should be able to read such data with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myData;
infile "&amp;amp;dirdata.SAS_Test/file_name.txt" delimiter="09"x DSD truncover firstobs=2;
input age$  /* other fields */;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the $ tells SAS that age is a character variable.&lt;/P&gt;</description>
    <pubDate>Sun, 11 Aug 2019 22:02:24 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2019-08-11T22:02:24Z</dc:date>
    <item>
      <title>Read in hyphen in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Read-in-hyphen-in-SAS/m-p/580430#M7817</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set with a variable "Age" looking like this:&lt;/P&gt;&lt;P&gt;Age&lt;/P&gt;&lt;P&gt;10-14&lt;/P&gt;&lt;P&gt;10-14&lt;/P&gt;&lt;P&gt;15-19&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is a tab-delimited data, so I use the code as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;infile "&amp;amp;dirdata.SAS_Test/file_name.txt" delimiter="09"x DSD truncover firstobs=2;&lt;/PRE&gt;&lt;P&gt;But the printout would be a typo between 10 and 14 for the variable "Age",&lt;/P&gt;&lt;P&gt;and influence my following analysis as SAS would complain for invalid symbol.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for all the suggestions!&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 21:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Read-in-hyphen-in-SAS/m-p/580430#M7817</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2019-08-11T21:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Read in hyphen in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Read-in-hyphen-in-SAS/m-p/580433#M7818</link>
      <description>&lt;P&gt;You should be able to read such data with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myData;
infile "&amp;amp;dirdata.SAS_Test/file_name.txt" delimiter="09"x DSD truncover firstobs=2;
input age$  /* other fields */;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the $ tells SAS that age is a character variable.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 22:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Read-in-hyphen-in-SAS/m-p/580433#M7818</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-08-11T22:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Read in hyphen in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Read-in-hyphen-in-SAS/m-p/580435#M7819</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Your INPUT statement is more important in this case than you INFILE statement. Are you trying to read age as a numeric variable or as a character variable? The value 10-14 is NOT valid as a numeric value. You need to read it as character. I doubt that age is the only value in your data. When I made a small test file that is tab delimited with just name and age columns, I was able to read the age value correctly by using the program shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="read_hyphen.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31667i0F5F315BC13B27C3/image-size/large?v=v2&amp;amp;px=999" role="button" title="read_hyphen.png" alt="read_hyphen.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 22:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Read-in-hyphen-in-SAS/m-p/580435#M7819</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-08-11T22:04:33Z</dc:date>
    </item>
  </channel>
</rss>

