<?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: sas macro with substring in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-with-substring/m-p/768876#M243891</link>
    <description>&lt;P&gt;First, many of use will not download Excel (or other Microsoft Office) files as they are a security risk. So I can't see your data. The proper way to provide data is:&amp;nbsp;&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, I don't see any particular need for a macro or macro variable here, you can do this in a DATA step without a macro and without a macro variable, using the SUBSTR function or the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/p0gq8bwobt4wjgn12km94wi66mxw.htm" target="_self"&gt;ANYDIGIT&lt;/A&gt; function. So I suggest you try that (or explain why you think you need a macro or a macro variable).&lt;/P&gt;</description>
    <pubDate>Tue, 21 Sep 2021 16:25:13 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-09-21T16:25:13Z</dc:date>
    <item>
      <title>sas macro with substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-with-substring/m-p/768875#M243890</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column of data in a dataset which is attached here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the violation column has TDGA and TDGR. First I need to be able to separate the TDGA from the TDGR and then extract only the number to the left.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance, if it is TDGR 6.1, I need only 6 (the digit to the left of the .)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Maitri&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 16:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macro-with-substring/m-p/768875#M243890</guid>
      <dc:creator>shahm</dc:creator>
      <dc:date>2021-09-21T16:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro with substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-with-substring/m-p/768876#M243891</link>
      <description>&lt;P&gt;First, many of use will not download Excel (or other Microsoft Office) files as they are a security risk. So I can't see your data. The proper way to provide data is:&amp;nbsp;&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, I don't see any particular need for a macro or macro variable here, you can do this in a DATA step without a macro and without a macro variable, using the SUBSTR function or the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/p0gq8bwobt4wjgn12km94wi66mxw.htm" target="_self"&gt;ANYDIGIT&lt;/A&gt; function. So I suggest you try that (or explain why you think you need a macro or a macro variable).&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 16:25:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macro-with-substring/m-p/768876#M243891</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-09-21T16:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro with substring</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macro-with-substring/m-p/768887#M243900</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
violation = "TDGR 6.1";
want_var = scan(scan(violation,2," "),1,".");
put want_var=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;No macro needed.&lt;/P&gt;
&lt;P&gt;Macros are for dynamic &lt;EM&gt;&lt;U&gt;code&lt;/U&gt;&lt;/EM&gt;, which is not the case here.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 16:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macro-with-substring/m-p/768887#M243900</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-21T16:29:27Z</dc:date>
    </item>
  </channel>
</rss>

