<?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 data format in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169443#M13019</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am seeing erratic behavior. Intermittently, when I try to print &amp;amp;birthdate, am getting warning&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference birthdate not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 12pt; font-family: Courier New;"&gt;How do I make sure that this does not happen?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Feb 2014 00:58:25 GMT</pubDate>
    <dc:creator>noobs</dc:creator>
    <dc:date>2014-02-11T00:58:25Z</dc:date>
    <item>
      <title>Macro variable data format</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169441#M13017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello EG Users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have following had-coded %Let statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%LET birthdate = '01JAN2014'd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to change it to be flexible and equal to another variable from dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%LET birthdate = bdate;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now bdate is of format mmddyy8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I make sure that macro variable birthdate gets assigned value of variable bdate however is similar to '01JAN2014'd?&lt;/P&gt;&lt;P&gt;In summary, I am trying to understand what that 'd does to value inside text?&lt;/P&gt;&lt;P&gt;I tried using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format birthdate mmddyy8.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as well as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format birthdate DATE9.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it did not work!?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Dhanashree&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 20:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169441#M13017</guid>
      <dc:creator>noobs</dc:creator>
      <dc:date>2014-02-10T20:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable data format</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169442#M13018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The d in a literal like '01JAN2014'd tells SAS to treat the string as an internal date value which is numeric. There is a similar suffix, dt, for use with datetime literals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If bdate is a variable in a dataset using %let will not assign its value to the macro variable birthdate. The main interface to assign values to macro variables from the data step is CALL SYMPUT. The syntax would generally be Call Symput ('birthdate', bdate); There are some cautions here though. If you dataset has multiple records the above syntax will only contain the value for the last record in the data set. Also, since macro variables are strings you probably want to control exactly what is the content and the default for dates probably won't be what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want the value of bdate to become something like '01jand2014'd then you would probably be best off to create an additional variable and use funtions to create a variable of interest.&lt;/P&gt;&lt;P&gt;This code in a data step will create a macro variable birthdate with the date of bdate appearing as 'DDMONYYYY'd&lt;/P&gt;&lt;P&gt;length datestring $ 12;&lt;/P&gt;&lt;P&gt;datestring = cats("'",put(bdate,date9.),"'d");&lt;/P&gt;&lt;P&gt;call symput('birthdate',datestring);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 20:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169442#M13018</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-02-10T20:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable data format</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169443#M13019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am seeing erratic behavior. Intermittently, when I try to print &amp;amp;birthdate, am getting warning&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference birthdate not resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 12pt; font-family: Courier New;"&gt;How do I make sure that this does not happen?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2014 00:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169443#M13019</guid>
      <dc:creator>noobs</dc:creator>
      <dc:date>2014-02-11T00:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable data format</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169444#M13020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This means the variable did not get created.&amp;nbsp; If you are creating it from a data step then the data step might not have run or ran with zero observations so it never executed the CALL SYMPUT().&amp;nbsp; One way to avoid this is to create the macro variable first with a default value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let birthdate=unknown;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set patients ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where pid = 5 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call symputx('birthdate',bdate);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2014 02:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169444#M13020</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-02-11T02:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable data format</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169445#M13021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the below code may help you&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; st_dt = '11FEB2014'd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &amp;amp;st_dt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;_NULL_&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white;"&gt;/*to use the same date with diffrent date format*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black;"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple;"&gt;"wst_end"&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black;"&gt;||put(&amp;amp;st_dt,&lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black;"&gt;)||&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple;"&gt;"'d"&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black;"&gt; &amp;amp;wst_end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt;/* goes 90 days back to the date present in the macro which you are passing */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"wst1_end"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;||put(intnx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'DAY'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&amp;amp;st_dt,-&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;90&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;'SAMEDAY'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;),&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;)||&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"'d"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &amp;amp;wst1_end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt;/*to use the same date in oracle quries (ie, connect to oracle ....) */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; symput(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"st_end"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;||put(&amp;amp;st_dt,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;)||&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple;"&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &amp;amp;st_end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Feb 2014 11:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-variable-data-format/m-p/169445#M13021</guid>
      <dc:creator>madanparna</dc:creator>
      <dc:date>2014-02-11T11:17:25Z</dc:date>
    </item>
  </channel>
</rss>

