<?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 What to use instead of assignment? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513806#M138491</link>
    <description>&lt;P&gt;I have to write a program that reads the data after datalines; in the code part. As you can see i use a assignment to remove the '',$ and the ** in the provided data. However i have to do the program without an assignment, which is quite troublesome. Any ideas on how to change it, so the program reads the code, but ignores "",$ and the **?&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data PERSONELL;
input @; 
  if not index(_infile_,'****');
  _infile_ = translate(_infile_,' ','$');
  length ID $ 4;
  length DEPT $ 1;
  input ID $ @1 DEPT $ BIRTHDAY date10. +(-5) YEAR :8. Salary comma8./;
  datalines;
A123  4Mar1989  8,6,00
***************
    A037 23Jun1957  21,450
**************
 M015 19Sep1977$17,500
***********
;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Nov 2018 08:04:41 GMT</pubDate>
    <dc:creator>torvin10</dc:creator>
    <dc:date>2018-11-16T08:04:41Z</dc:date>
    <item>
      <title>What to use instead of assignment?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513806#M138491</link>
      <description>&lt;P&gt;I have to write a program that reads the data after datalines; in the code part. As you can see i use a assignment to remove the '',$ and the ** in the provided data. However i have to do the program without an assignment, which is quite troublesome. Any ideas on how to change it, so the program reads the code, but ignores "",$ and the **?&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data PERSONELL;
input @; 
  if not index(_infile_,'****');
  _infile_ = translate(_infile_,' ','$');
  length ID $ 4;
  length DEPT $ 1;
  input ID $ @1 DEPT $ BIRTHDAY date10. +(-5) YEAR :8. Salary comma8./;
  datalines;
A123  4Mar1989  8,6,00
***************
    A037 23Jun1957  21,450
**************
 M015 19Sep1977$17,500
***********
;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 08:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513806#M138491</guid>
      <dc:creator>torvin10</dc:creator>
      <dc:date>2018-11-16T08:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: What to use instead of assignment?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513815#M138497</link>
      <description>&lt;P&gt;What was wrong with the solution provided in &lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-handle-special-characters-in-data/m-p/512848" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/How-to-handle-special-characters-in-data/m-p/512848&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does the line with A037 start with blanks (or tab)?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 08:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513815#M138497</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-11-16T08:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: What to use instead of assignment?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513816#M138498</link>
      <description>&lt;P&gt;What issues do you have?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) why is '/' at the end of the INPUT statement ?&lt;/P&gt;
&lt;P&gt;2) is it not your typo having two commas in first line salary ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;A123  4Mar1989  8,6,00&lt;/PRE&gt;
&lt;P&gt;3) Your code is:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input ID $ @1 DEPT $ ......&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;did you mean:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input id $1. dept $3. .......&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the&amp;nbsp;@1 means to read fromthe 1st position of the row&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 08:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513816#M138498</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-16T08:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: What to use instead of assignment?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513822#M138501</link>
      <description>&lt;P&gt;Blanks. And the solution is good, however im trying to do it without assignment statements, and isn´t the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;_infile_ = translate(_infile_,' ','$');&lt;/PRE&gt;&lt;P&gt;an assignment?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 09:02:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513822#M138501</guid>
      <dc:creator>torvin10</dc:creator>
      <dc:date>2018-11-16T09:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: What to use instead of assignment?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513823#M138502</link>
      <description>&lt;P&gt;Sas studio(Mac user)&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the data is at was given to me, and the / from the INPUT statment had sneaked in, thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 09:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513823#M138502</guid>
      <dc:creator>torvin10</dc:creator>
      <dc:date>2018-11-16T09:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: What to use instead of assignment?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513826#M138503</link>
      <description>&lt;P&gt;From where do you get such an exercise? I hope it's not out of material that SAS provides for their courses.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 09:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513826#M138503</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-16T09:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: What to use instead of assignment?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513828#M138505</link>
      <description>&lt;P&gt;Try next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data PERSONELL;
   infile datalines dlm='$' ; /* assuming the $ is the delimiter between vars */
    input ID $4. @;
    if ID = '****' then do; delete; input; end;&lt;BR /&gt;    else 
      input  +(-1)  DEPT $1.
            BIRTHDAY date10. +(-5) YEAR :8. Salary comma8.;
datalines;
A123  4Mar1989  8,600
***************
    A037 23Jun1957  21,450
**************
 M015 19Sep1977$17,500
***********
;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 09:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513828#M138505</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2018-11-16T09:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: What to use instead of assignment?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513843#M138511</link>
      <description>To treat unwanted characters as blanks, put them into the DLM= option on an INFILE statement.&lt;BR /&gt;&lt;BR /&gt;this only  fails if you  also need the DSD option ( not the case here)&lt;BR /&gt;Then your data step needs only &lt;BR /&gt;Data got it;&lt;BR /&gt; INFILE DATALINES dlm= '$ *'  ;&lt;BR /&gt; Input id :$4. Birthday : date9. Salary :comma11. @1 dept :$1. ;&lt;BR /&gt;Datalines;&lt;BR /&gt;....And then your lines&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Nov 2018 11:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-to-use-instead-of-assignment/m-p/513843#M138511</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2018-11-16T11:08:58Z</dc:date>
    </item>
  </channel>
</rss>

