<?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: Use environment string as variable name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173861#M33379</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you need CALL SYMPUT?&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; temp_path = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%sysget&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(temp);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; file_name = &amp;amp;temp_path\vbs_file.vbs;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Feb 2014 12:50:17 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2014-02-14T12:50:17Z</dc:date>
    <item>
      <title>Use environment string as variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173858#M33376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings all.&amp;nbsp; I'm wanting to use SAS to call a VBScript file in a user's temp directory.&amp;nbsp; After some googling, I found what I think should work, but I keep getting errors.&amp;nbsp; In the below code, I am using %sysget(temp) to get the path, but then I want to append it with '\filename.vbs', but I am getting a 'not resolved error.&amp;nbsp; Could anyone explain why?&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let temp_path = %sysget(temp) ;&lt;/P&gt;&lt;P&gt;data _null_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;temp_path ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('file_name',cat("'",&amp;amp;tpath,"\file_name.vbs","'")) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;file_name ;&lt;/P&gt;&lt;P&gt;run ; quit ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 21:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173858#M33376</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-02-13T21:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Use environment string as variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173859#M33377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Move the %put statement OUT of the data step. The macro variable is not actually available until the datastep completes.&lt;/P&gt;&lt;P&gt;Generally you can't reference created macro variables in a datastep that creates them.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 21:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173859#M33377</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-02-13T21:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Use environment string as variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173860#M33378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you ballardw.&amp;nbsp; I had the %put in there just so I could verify that the temp_file variable was being correctly assigned.&amp;nbsp; It seems the real issue is when I try to use it in the symput routine.&amp;nbsp; If I move the symput into it's own data step, that's where I get the issue...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* no problems here, temp_path assigned as expected ;&lt;/P&gt;&lt;P&gt;%let temp_path = %sysget(temp) ;&lt;/P&gt;&lt;P&gt;data _null_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;temp_path ;&lt;/P&gt;&lt;P&gt;run ; quit ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* now, when I try to use temp_path in a symput routine, I get error ;&lt;/P&gt;&lt;P&gt;data _null_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput('file_name',cat(&amp;amp;temp_path,'\vbs_file.vbs')) ;&lt;/P&gt;&lt;P&gt;run ; quit ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like to happen is to end up with a file_name variable eq 'C:\Users\username\AppData\Local\Temp\1\vbs_file.vbs', so that I can then use the file_name variable to write create, write to, then execute like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x &amp;amp;file_name ;&lt;/P&gt;&lt;P&gt;run ; quit ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 11:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173860#M33378</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-02-14T11:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Use environment string as variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173861#M33379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you need CALL SYMPUT?&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; temp_path = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%sysget&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(temp);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; file_name = &amp;amp;temp_path\vbs_file.vbs;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 12:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173861#M33379</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-02-14T12:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Use environment string as variable name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173862#M33380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much data_null_;.&amp;nbsp; Once again, I was over complicating it.&amp;nbsp; I put it in the symput because I need it for other stuff, and I figured that since it was already there, why not.&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Feb 2014 13:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-environment-string-as-variable-name/m-p/173862#M33380</guid>
      <dc:creator>gsnidow</dc:creator>
      <dc:date>2014-02-14T13:52:10Z</dc:date>
    </item>
  </channel>
</rss>

