<?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 get substring from variablename in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/get-substring-from-variablename/m-p/57537#M12414</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; reddy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with what code do you read the file into SAS?&lt;/P&gt;&lt;P&gt;Whatever it is,&amp;nbsp; that might have an option to create column names that are easier to work with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like the existing routine is generating column names that conform to option validvarnane= any;&lt;/P&gt;&lt;P&gt;These are awkward to handle in the macro language but simpler in a data step.&lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;P class="SASCode"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="color: blue;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; _n_ = &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="color: teal;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="color: blue;"&gt;then&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; execute(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;' data final ; set sasuser.test12; rename '&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;set&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; contents&amp;nbsp; end= eof ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;where&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; lowcase(name)=: &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;'pack units-'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;&amp;nbsp; ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;length&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; newA1 $&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="color: teal;"&gt;32&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;&amp;nbsp; newA1 = scan( name, -&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="color: teal;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;'-'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ) ; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: green;"&gt;*picking out the suffix after the - ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; execute( quote(trim(name)) !! &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;'n&amp;nbsp; =&amp;nbsp; '&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; !! quote( trim(newA1)) !! &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;'n'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;&amp;nbsp; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; eof ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; execute( &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;' ; run ;'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt; ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 31 Aug 2011 21:41:30 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2011-08-31T21:41:30Z</dc:date>
    <item>
      <title>get substring from variablename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-substring-from-variablename/m-p/57535#M12412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&lt;SPAN style="font-size: 10pt; color: #000080;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&amp;nbsp;&amp;nbsp; I'm getting csv file as input......In&amp;nbsp; that three columns are varying all time.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&amp;nbsp;&amp;nbsp; So, i'm using below code to handle that one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&amp;nbsp; From those variables i want to pick part of the string.,I'm trying below code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&amp;nbsp; getting error....Can somebody help me how to handle this scenario.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&amp;nbsp; from this variable Pack Units-jun'11 ....i have to pick&amp;nbsp; just jun'11.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&amp;nbsp; Here is error msg:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;rename&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;26 ! &amp;amp;vara1=substr(compress(&amp;amp;vara1),length(&amp;amp;vara1),-5);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;_&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;ERROR: Alphabetic prefixes for enumerated variables (PackUnits-jun11) are different.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;2 The SAS System 16:18 Tuesday, August 30, 2011&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;26 (compress(&amp;amp;vara1),length(&amp;amp;vara1),-5);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;_&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;76&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, -, :, ;. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;27 run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #000080;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Proc contents data = SASUSER.TEST12 out = contents1;&lt;BR /&gt;run; &lt;/P&gt;&lt;P&gt;Proc sql;&lt;BR /&gt;select distinct name into&amp;nbsp; : vara1-:vara3 from contents1 where name not in ('Account Manager','CORPORATE PARENT NAME')&lt;BR /&gt;order by VARNUM;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-size: 10pt; color: #000080;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;P&gt;&lt;BR /&gt;data final ;&lt;BR /&gt;set SASUSER.TEST12;&lt;BR /&gt;rename &amp;amp;vara1=substr(compress(&amp;amp;vara1),length(&amp;amp;vara1),-5);&lt;BR /&gt;run;&lt;/P&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;reddy.&lt;/SPAN&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;SPAN style="font-size: 10pt; color: #000080;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-size: 10pt; color: #000080;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-size: 10pt; color: #000080;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-size: 10pt; color: #000080;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="font-size: 10pt; color: #000080;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="color: #000080; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2011 04:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-substring-from-variablename/m-p/57535#M12412</guid>
      <dc:creator>reddy19</dc:creator>
      <dc:date>2011-08-31T04:36:28Z</dc:date>
    </item>
    <item>
      <title>get substring from variablename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-substring-from-variablename/m-p/57536#M12413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;options validvarname=any;
data test;
"Pack Units-jun'11"n= 'asdasdf';
run;
%let var1= %str(Pack Units-jun%'11) ;
proc datasets library=work memtype=data;
 modify test;
 rename "%unquote(&amp;amp;var1)"n="%scan(&amp;amp;var1,-1,%str(-))"n;
quit;
%put _user_;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2011 07:04:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-substring-from-variablename/m-p/57536#M12413</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-08-31T07:04:20Z</dc:date>
    </item>
    <item>
      <title>get substring from variablename</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-substring-from-variablename/m-p/57537#M12414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; reddy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with what code do you read the file into SAS?&lt;/P&gt;&lt;P&gt;Whatever it is,&amp;nbsp; that might have an option to create column names that are easier to work with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like the existing routine is generating column names that conform to option validvarnane= any;&lt;/P&gt;&lt;P&gt;These are awkward to handle in the macro language but simpler in a data step.&lt;/P&gt;&lt;P&gt;like:&lt;/P&gt;&lt;P class="SASCode"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="color: blue;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; _n_ = &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="color: teal;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN-US" style="color: blue;"&gt;then&lt;/SPAN&gt; &lt;SPAN lang="EN-US" style="color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; execute(&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;' data final ; set sasuser.test12; rename '&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;set&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; contents&amp;nbsp; end= eof ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;where&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; lowcase(name)=: &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;'pack units-'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;&amp;nbsp; ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;length&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; newA1 $&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="color: teal;"&gt;32&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;&amp;nbsp; newA1 = scan( name, -&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="color: teal;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;'-'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ) ; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: green;"&gt;*picking out the suffix after the - ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; execute( quote(trim(name)) !! &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;'n&amp;nbsp; =&amp;nbsp; '&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; !! quote( trim(newA1)) !! &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;'n'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt;&amp;nbsp; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;if&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; eof ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&amp;nbsp; &lt;SPAN lang="EN-US" style="color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; execute( &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: purple;"&gt;' ; run ;'&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="color: black;"&gt; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SASCode"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt; ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Aug 2011 21:41:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-substring-from-variablename/m-p/57537#M12414</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-08-31T21:41:30Z</dc:date>
    </item>
  </channel>
</rss>

