<?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: Macro variable in nested quotes in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/629800#M20777</link>
    <description>&lt;P&gt;You create a macro variable, but you never use it.&lt;/P&gt;
&lt;P&gt;You also use the %put incorrectly; since it is part of the data step code, it is resolved before the data step runs and creates &amp;amp;targetyear. You need to move it past the run; statement to be effective.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Mar 2020 13:50:52 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-03-05T13:50:52Z</dc:date>
    <item>
      <title>Macro variable in nested quotes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/629781#M20775</link>
      <description>&lt;P&gt;I successfully run the code below, my file gets saved into the 2020 folder.&lt;/P&gt;&lt;P&gt;But when I substitute 2020 with &amp;amp;TargetYear I get no output. I have tried multiple combinations of quotes, no help.&lt;/P&gt;&lt;PRE&gt;data _null_;
	%global TargetYear;
	year = year(input("&amp;amp;sysdate9",date9.));
	Call symput("TargetYear", year);&lt;BR /&gt;        %put &amp;amp;TargetYear;
run;
data _null_;
	CALL SYSTEM("lftp 
		ftps://xxxx:xxxxx.com 
		-e 'cd mysite/vcr/from/2020;
		put /prd/data/LAST5_VISIT_HRS.html; 
		quit;'");
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Mar 2020 13:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/629781#M20775</guid>
      <dc:creator>Espresso</dc:creator>
      <dc:date>2020-03-05T13:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable in nested quotes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/629800#M20777</link>
      <description>&lt;P&gt;You create a macro variable, but you never use it.&lt;/P&gt;
&lt;P&gt;You also use the %put incorrectly; since it is part of the data step code, it is resolved before the data step runs and creates &amp;amp;targetyear. You need to move it past the run; statement to be effective.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 13:50:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/629800#M20777</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-05T13:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable in nested quotes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/629804#M20779</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	%global TargetYear;
	year = year(input("&amp;amp;sysdate9",date9.));
	Call symput("TargetYear", year);
        %put &amp;amp;TargetYear;
run;
data _null_;
	CALL SYSTEM(%sysfunc(quote(lftp 
		ftps://xxxx:xxxxx.com 
		-e "cd mysite/vcr/from/&amp;amp;TargetYear;
		put /prd/data/LAST5_VISIT_HRS.html; 
		quit;"));
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You can use the quote function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 14:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/629804#M20779</guid>
      <dc:creator>rudfaden</dc:creator>
      <dc:date>2020-03-05T14:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable in nested quotes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/629807#M20781</link>
      <description>&lt;P&gt;Simplify your step, and use call symputx:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symputx("TargetYear", year(today()),'g');
run;

data _null_;
call system(
"lftp ftps://xxxx:xxxxx.com -e 'cd mysite/vcr/from/2020;put /prd/data/LAST5_VISIT_HRS.html; quit;'"
);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Call symputx automatically strips the value it stores in the macro variable.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 14:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/629807#M20781</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-05T14:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable in nested quotes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/630058#M20791</link>
      <description>&lt;P&gt;Thank you for the reply, your code ran well after adding an extra parenthesis:&amp;nbsp; quit;")));&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 12:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/630058#M20791</guid>
      <dc:creator>Espresso</dc:creator>
      <dc:date>2020-03-06T12:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable in nested quotes</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/630061#M20793</link>
      <description>&lt;P&gt;Thanks a lot, as you mentioned, this was a fundamental issue with making the macro variable persistent, thanks!&lt;/P&gt;&lt;PRE&gt;data _null_;
call symputx("&lt;FONT color="#FF0000"&gt;TargetYear&lt;/FONT&gt;", year(today()),'g');
run;

data _null_;
call system(
"lftp ftps://xxxx:xxxxx.com -e 'cd mysite/vcr/from/&lt;FONT color="#FF0000"&gt;&amp;amp;TargetYear&lt;/FONT&gt;;put /prd/data/LAST5_VISIT_HRS.html; quit;'"
);
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Mar 2020 13:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Macro-variable-in-nested-quotes/m-p/630061#M20793</guid>
      <dc:creator>Espresso</dc:creator>
      <dc:date>2020-03-06T13:14:25Z</dc:date>
    </item>
  </channel>
</rss>

