<?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: Delimiter not working during import of data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delimiter-not-working-during-import-of-data/m-p/743102#M232573</link>
    <description>&lt;P&gt;By using formatted input for the first two variables, you override the delimiter. Use the colon modifier to prevent this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input
  Item_ID :$9.	
  Item_Type :$7.    &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 22 May 2021 06:57:01 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-05-22T06:57:01Z</dc:date>
    <item>
      <title>Delimiter not working during import of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delimiter-not-working-during-import-of-data/m-p/743095#M232569</link>
      <description>&lt;PRE&gt;options validvarname=v7;
data My_Report;
infile '/myshare/report1.csv' 
delimiter = ','  firstobs=2 ;
input Item_ID $9.     /*$ 1-9 $9. */			
			Item_Type $7.    /*$11-16    $7.*/
			Description $&lt;BR /&gt;                        Email $
;run;&lt;/PRE&gt;
&lt;P&gt;The above code produces this&lt;/P&gt;
&lt;TABLE width="483"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="76"&gt;Item_ID&lt;/TD&gt;
&lt;TD width="73"&gt;Item_Type&lt;/TD&gt;
&lt;TD width="78"&gt;Description&lt;/TD&gt;
&lt;TD width="64"&gt;Email&lt;/TD&gt;
&lt;TD width="64"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;MRG570-15&lt;/TD&gt;
&lt;TD&gt;,CENTRAL&lt;/TD&gt;
&lt;TD&gt;XYZ Cert&lt;/TD&gt;
&lt;TD colspan="3"&gt;&lt;A href="mailto:manning@email.com" target="_blank"&gt;manning@email.com&lt;/A&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;MRG570-15&lt;/TD&gt;
&lt;TD&gt;,CENTRAL&lt;/TD&gt;
&lt;TD&gt;XYZ Cert&lt;/TD&gt;
&lt;TD colspan="4"&gt;&lt;A href="mailto:jrobinsonsmith@myemail.com" target="_blank"&gt;jrobinsonsmith@myemail.com&lt;/A&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;MRG570-15&lt;/TD&gt;
&lt;TD&gt;,CENTRAL&lt;/TD&gt;
&lt;TD&gt;XYZ Cert&lt;/TD&gt;
&lt;TD colspan="4"&gt;&lt;A href="mailto:walterjones@remmington.Com" target="_blank"&gt;walterjones@remmington.Com&lt;/A&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;BR /&gt;1. Notice in Item_Type it begins with the comma&amp;nbsp;&lt;/SPAN&gt;I want the data to read to the comma delimiter then read the next variable.&amp;nbsp; In this case it began with the comma.&lt;/P&gt;
&lt;P&gt;2. In the Description it only reads the first 8 places.&amp;nbsp; XYZ Cert.&amp;nbsp; It is not reading to the comma despite me placing the delimiter requirement in the code.&amp;nbsp; Is there a way to read in the data more clean?? As you can see I tried defining the length however I have other fields to import such as email which will have varying lengths.&lt;/P&gt;</description>
      <pubDate>Sat, 22 May 2021 01:57:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delimiter-not-working-during-import-of-data/m-p/743095#M232569</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2021-05-22T01:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Delimiter not working during import of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delimiter-not-working-during-import-of-data/m-p/743101#M232572</link>
      <description>&lt;P&gt;Please post an example of your csv file, or attach it to the post.&lt;/P&gt;
&lt;P&gt;To post an example, open the file with a text editor (not with Excel!) and copy/paste a few lines into a code box opened with the &amp;lt;/&amp;gt; button.&lt;/P&gt;</description>
      <pubDate>Sat, 22 May 2021 06:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delimiter-not-working-during-import-of-data/m-p/743101#M232572</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-22T06:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Delimiter not working during import of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delimiter-not-working-during-import-of-data/m-p/743102#M232573</link>
      <description>&lt;P&gt;By using formatted input for the first two variables, you override the delimiter. Use the colon modifier to prevent this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input
  Item_ID :$9.	
  Item_Type :$7.    &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 May 2021 06:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delimiter-not-working-during-import-of-data/m-p/743102#M232573</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-22T06:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Delimiter not working during import of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delimiter-not-working-during-import-of-data/m-p/743132#M232587</link>
      <description>&lt;P&gt;I find it is worth the extra line of code to actual DEFINE the variables instead of forcing SAS to guess how to define them based on how they are first used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a LENGTH statement to define the variables.&amp;nbsp; Use a length of 8 for numeric variables (SAS stores numbers as 64-bit floating point values).&amp;nbsp; Set the character variables long enough to hold the longest value you expect.&amp;nbsp; Currently you are letting DESCRIPTION and EMAIL default to length just 8 bytes.&amp;nbsp; Which is probably too short for variables with names like that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you define the variables in the order they appear in the file your INPUT statement can just a position based variable list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data My_Report;
  infile '/myshare/report1.csv' dsd firstobs=2 truncover ; 
  length Item_ID $9 Item_Type $7 Description $40 Email $50 ;
  input Item_ID -- Email;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The TRUNCOVER option will prevent the INPUT statement from jumping to the next line if there are not enough values on the current line.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 May 2021 14:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delimiter-not-working-during-import-of-data/m-p/743132#M232587</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-05-22T14:36:18Z</dc:date>
    </item>
  </channel>
</rss>

