<?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: Call variable in variable% LET in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550399#M8775</link>
    <description>&lt;P&gt;If you really need to do this in a separate program, you have to save a permanent SAS data set.&amp;nbsp; There is no way to transfer macro variables from one program to another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;save the data set permanently:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data perm.something_to_hold_dia;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then in your other program:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;set perm.something_to_hold_dia;&lt;/P&gt;
&lt;P&gt;call symputx('FECH_', dia);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Apr 2019 20:12:33 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-04-11T20:12:33Z</dc:date>
    <item>
      <title>Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550379#M8763</link>
      <description>&lt;P&gt;I have a variable called Dia and saves a result with formed AAAAMMDD,&amp;nbsp; the code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;FECHA_HACE_DIAS = INTNX('MONTH', TODAY(), -1);&lt;BR /&gt;put 'FECHA_HACE_DIAS' FECHA_HACE_DIAS DATE9.;&lt;BR /&gt;A = TODAY();&lt;BR /&gt;put 'TODAY' A DATE9.;&lt;BR /&gt;y = YEAR(FECHA_HACE_DIAS);&lt;BR /&gt;m = MONTH(FECHA_HACE_DIAS);&lt;BR /&gt;d = DAY(FECHA_HACE_DIAS);&lt;BR /&gt;Dia = (y*10000 + m*100 + d);&lt;BR /&gt;put Dia;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV class="mt-info-text"&gt;I Need to call the variable "Dia" in a variable macro called "%LET FECH_=" ... I call it the following way&lt;BR /&gt;"%LET FECH_ =&amp;amp;Dia;"&lt;/DIV&gt;&lt;DIV class="mt-info-text"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mt-info-text"&gt;&lt;DIV class="mt-info-text"&gt;I NEED TO DO THIS TO CALL THE MACRO VARIABLE FECH_ IN ANOTHER PROGRAM SAS&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 11 Apr 2019 19:26:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550379#M8763</guid>
      <dc:creator>yesidgranadosv</dc:creator>
      <dc:date>2019-04-11T19:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550380#M8764</link>
      <description>It's hard to understand what you're asking here, but I think you're looking for CALL SYMPUT which you can use to create a macro variable from within a data step. Also, pretty sure there's SAS format you can use directly to get the data in the format needed. &lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;%let dia=%syfunc(today(), yymmdd10.);&lt;BR /&gt;%put &amp;amp;dia.;</description>
      <pubDate>Thu, 11 Apr 2019 19:29:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550380#M8764</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-11T19:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550381#M8765</link>
      <description>&lt;DIV class="mt-info-text"&gt;In which way I can be more specific, your solution is not very clear&lt;/DIV&gt;</description>
      <pubDate>Thu, 11 Apr 2019 19:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550381#M8765</guid>
      <dc:creator>yesidgranadosv</dc:creator>
      <dc:date>2019-04-11T19:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550392#M8771</link>
      <description>Did you run it? What does it create?</description>
      <pubDate>Thu, 11 Apr 2019 20:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550392#M8771</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-11T20:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550394#M8773</link>
      <description>&lt;P&gt;If you submit the following code it will generate a Macro variable "dia" that contains todays&amp;nbsp;date in the format yyyy-mm-dd&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dia=%sysfunc(today(), yymmdd10.);
%put &amp;amp;dia.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550394#M8773</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2019-04-11T20:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550396#M8774</link>
      <description>ah...I got the format wrong. And try yymmddn10 or yymmddd10 for the one with no dashes.</description>
      <pubDate>Thu, 11 Apr 2019 20:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550396#M8774</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-11T20:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550399#M8775</link>
      <description>&lt;P&gt;If you really need to do this in a separate program, you have to save a permanent SAS data set.&amp;nbsp; There is no way to transfer macro variables from one program to another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;save the data set permanently:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data perm.something_to_hold_dia;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then in your other program:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;set perm.something_to_hold_dia;&lt;/P&gt;
&lt;P&gt;call symputx('FECH_', dia);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:12:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550399#M8775</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-11T20:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550400#M8776</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269250"&gt;@yesidgranadosv&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;DIV class="mt-info-text"&gt;In which way I can be more specific, your solution is not very clear&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt;data _null_;
   call symputx('Fetch_', put(intnx ('month',today(),-1),yymmddn8.) );
run;

%put Fetch_ = &amp;amp;Fetch_.;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550400#M8776</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-11T20:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550407#M8780</link>
      <description>&lt;DIV class="mt-info-text"&gt;I need format 20190411 not&amp;nbsp;2019-04-11&lt;/DIV&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550407#M8780</guid>
      <dc:creator>yesidgranadosv</dc:creator>
      <dc:date>2019-04-11T20:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550421#M8789</link>
      <description>&lt;DIV class="mt-info-text"&gt;Thank you Very Much, the truth if I work, but in this case I need to bring the 16th of each month&lt;/DIV&gt;</description>
      <pubDate>Thu, 11 Apr 2019 20:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550421#M8789</guid>
      <dc:creator>yesidgranadosv</dc:creator>
      <dc:date>2019-04-11T20:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550428#M8795</link>
      <description>&lt;P&gt;From my understanding of the problem, you need to create the 16th day of every month in yyyymmdd format and save it as macro var fech_&lt;/P&gt;&lt;P&gt;Then you need this macro var in another program.&amp;nbsp; Basically the code calculates the last day of the previous month and then forwards it by 16 days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So you save the data&amp;nbsp; _null_ part in one program say day16.sas.&amp;nbsp; Then call this program using %include in your other program where you will have access to Fech_ macrovar&lt;/P&gt;&lt;PRE&gt;/* save this part as day16.sas */&lt;BR /&gt;data _null_;&lt;BR /&gt;&lt;BR /&gt;call symputx('fech_',compress(put((intnx('month',today(),-1,'e')+16),yymmdd10.),'-'));&lt;BR /&gt;run;&lt;BR /&gt;/* check macro var fech_ */&lt;BR /&gt;%put &amp;amp;fech_;&lt;BR /&gt;&lt;BR /&gt;/* end of day16.sas */&lt;BR /&gt;&lt;BR /&gt;/* In your other sas program call day16.sas  */&lt;BR /&gt;/* %include "day16.sas"; */&lt;BR /&gt;&lt;BR /&gt;/* Now you have access to &amp;amp;fech_ macro variable */&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:20:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550428#M8795</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2019-04-11T21:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550430#M8796</link>
      <description>&lt;P&gt;The fourth parameter of INTNX allows you to align the data to the start, end or middle of the month. I would recommend doing the start and adding 15 to get the 16th day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   call symputx('Fetch_', put(intnx ('month',today(),-1, 'b') + 16 ,yymmddn8.) );
run;

%put Fetch_ = &amp;amp;Fetch_.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269250"&gt;@yesidgranadosv&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;DIV class="mt-info-text"&gt;Thank you Very Much, the truth if I work, but in this case I need to bring the 16th of each month&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550430#M8796</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-11T21:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550432#M8797</link>
      <description>Or that entire line could be in a %LET as I sort of showed earlier, but with some more nesting of %SYSFUNC().</description>
      <pubDate>Thu, 11 Apr 2019 21:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550432#M8797</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-11T21:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Call variable in variable% LET</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550433#M8798</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/269250"&gt;@yesidgranadosv&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;DIV class="mt-info-text"&gt;Thank you Very Much, the truth if I work, but in this case I need to bring the 16th of each month&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Current month? Previous Month? Next month?&lt;/P&gt;
&lt;PRE&gt;data _null_;
   date= mdy(month(today()),16, year(today()));
   call symputx('CurrentMonthFetch_', put(date,yymmddn8.) );
   date= mdy(month(intnx('month',(today()),-1)),16, year(intnx('month',(today()),-1)));
   call symputx('PrevMonthFetch_', put(date,yymmddn8.) );
run;

%put CurrentMonthFetch_ = &amp;amp;CurrentMonthFetch_.;
%put PrevMonthFetch_ = &amp;amp;PrevMonthFetch_.;
&lt;/PRE&gt;
&lt;P&gt;The INTNX function does support a "middle" options such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
date = intnx('month',today(),-1,'middle');
put date yymmddn8.;
run;&lt;/PRE&gt;
&lt;P&gt;Which may or may not be exactly what you want but may make more sense for February with the 14th as middle in most years, or 15 for months with 30 days.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 21:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Call-variable-in-variable-LET/m-p/550433#M8798</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-11T21:15:38Z</dc:date>
    </item>
  </channel>
</rss>

