<?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: WARNING: Apparent symbolic reference PREV_D not resolved in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785915#M250869</link>
    <description>Sorry, yes. I want to use a character format.</description>
    <pubDate>Tue, 14 Dec 2021 00:25:10 GMT</pubDate>
    <dc:creator>dualice</dc:creator>
    <dc:date>2021-12-14T00:25:10Z</dc:date>
    <item>
      <title>WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785887#M250862</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following SAS code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;LIBNAME TESTS '/disk1/sand/SAS/workdir' ;

options mprint symbolgen;

data TESTS.SYMPUT_001_DS0;
call symputx('curr_dt',put(today(),yymmddn8.),'G');
call symput('curr_date', put('&amp;amp;&amp;amp;curr_dt&amp;amp;',8.));
call symputx('prev_dt',put(today()-1,yymmddn8.),'G');
call symput('prev_date', put('&amp;amp;&amp;amp;prev_dt&amp;amp;',8.));

curr_dt = put(today(),yymmddn8.);
curr_date = put('&amp;amp;&amp;amp;curr_dt&amp;amp;',8.);
prev_dt = put(today() - 1,yymmddn8.);
prev_date = put('&amp;amp;&amp;amp;prev_dt&amp;amp;',8.);
run;

%put &amp;amp;=curr_dt ;
%put &amp;amp;=curr_date ;
%put &amp;amp;=prev_date ;
%put &amp;amp;=prev_dt ;

data TESTS.SYMPUT_001_DS1;
set TESTS.SYMPUT_001_DS0;
length dt_num 8;
length dt_str $ 10;

dt_num = &amp;amp;curr_dt;
dt_str = '&amp;amp;&amp;amp;curr_date&amp;amp;.';
output;

dt_num = &amp;amp;prev_dt;
dt_str = '&amp;amp;&amp;amp;prev_date&amp;amp;.';
output;

if &amp;amp;curr_dt &amp;gt; &amp;amp;prev_dt then output;
run;

data TESTS.SYMPUT_001_DS2;
set TESTS.SYMPUT_001_DS1;
where dt_num = &amp;amp;curr_dt;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run it using command line SAS (9.4) on linux, I get the following errors:&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference CURR_D not resolved.&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference PREV_D not resolved&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know what is wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;BR /&gt;Peter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 21:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785887#M250862</guid>
      <dc:creator>dualice</dc:creator>
      <dc:date>2021-12-13T21:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785893#M250864</link>
      <description>&lt;P&gt;First thing is that macro variables will not resolve inside single quotes so none of these Put resolve anything.&lt;/P&gt;
&lt;PRE&gt;
call symput('curr_date', put('&amp;amp;&amp;amp;curr_dt&amp;amp;',8.));
call symput('prev_date', put('&amp;amp;&amp;amp;prev_dt&amp;amp;',8.));
&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Second is that you cannot use the macro variables in the same data step that creates then as you are attempting to do so they aren't defined in the first data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Somewhat of an example:&lt;/P&gt;
&lt;PRE&gt;data example;
call symputx('curr_dt',put(today(),yymmddn8.),'G');
run;

%put Curr_dt is: &amp;amp;curr_dt.;
/* resolves to  Curr_dt is: 20211213*/

data junk;
  call symput('curr_date', put("&amp;amp;&amp;amp;curr_dt&amp;amp;",8.));
run;
%put Curr_date is: &amp;amp;curr_date.;
/*Resolves to Curr_date is: 20211213*/&lt;/PRE&gt;
&lt;P&gt;Your code is a convoluted way to make a second variable with the same value as currently attempted.&lt;/P&gt;
&lt;P&gt;BTW, if you intend to compare these to SAS date values you may be disappointed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: Your warnings would not come from the code shown. There is no place you use macro variables CURR_D or PREV_D, you use CURR_DT and PREV_DT. So those warnings come from different code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/409802"&gt;@dualice&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following SAS code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;LIBNAME TESTS '/disk1/sand/SAS/workdir' ;

options mprint symbolgen;

data TESTS.SYMPUT_001_DS0;
call symputx('curr_dt',put(today(),yymmddn8.),'G');
call symput('curr_date', put('&amp;amp;&amp;amp;curr_dt&amp;amp;',8.));
call symputx('prev_dt',put(today()-1,yymmddn8.),'G');
call symput('prev_date', put('&amp;amp;&amp;amp;prev_dt&amp;amp;',8.));

curr_dt = put(today(),yymmddn8.);
curr_date = put('&amp;amp;&amp;amp;curr_dt&amp;amp;',8.);
prev_dt = put(today() - 1,yymmddn8.);
prev_date = put('&amp;amp;&amp;amp;prev_dt&amp;amp;',8.);
run;

%put &amp;amp;=curr_dt ;
%put &amp;amp;=curr_date ;
%put &amp;amp;=prev_date ;
%put &amp;amp;=prev_dt ;

data TESTS.SYMPUT_001_DS1;
set TESTS.SYMPUT_001_DS0;
length dt_num 8;
length dt_str $ 10;

dt_num = &amp;amp;curr_dt;
dt_str = '&amp;amp;&amp;amp;curr_date&amp;amp;.';
output;

dt_num = &amp;amp;prev_dt;
dt_str = '&amp;amp;&amp;amp;prev_date&amp;amp;.';
output;

if &amp;amp;curr_dt &amp;gt; &amp;amp;prev_dt then output;
run;

data TESTS.SYMPUT_001_DS2;
set TESTS.SYMPUT_001_DS1;
where dt_num = &amp;amp;curr_dt;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run it using command line SAS (9.4) on linux, I get the following errors:&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference CURR_D not resolved.&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference PREV_D not resolved&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know what is wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;BR /&gt;Peter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 22:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785893#M250864</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-12-13T22:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785898#M250865</link>
      <description>&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the log:&lt;/P&gt;&lt;P&gt;SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;.&lt;BR /&gt;WARNING: Apparent symbolic reference CURR_DT not resolved.&lt;BR /&gt;9 call symputx('prev_dt',put(today()-1,yymmddn8.),'G');&lt;BR /&gt;2 The SAS System 17:08 Monday, December 13, 2021&lt;/P&gt;&lt;P&gt;10 call symput('prev_date', put("&amp;amp;&amp;amp;prev_dt&amp;amp;",8.));&lt;BR /&gt;SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;.&lt;BR /&gt;WARNING: Apparent symbolic reference PREV_DT not resolved.&lt;BR /&gt;11&lt;BR /&gt;12 curr_dt = put(today(),yymmddn8.);&lt;BR /&gt;13 curr_date = put("&amp;amp;&amp;amp;curr_dt&amp;amp;",8.);&lt;BR /&gt;SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;.&lt;BR /&gt;WARNING: Apparent symbolic reference CURR_DT not resolved.&lt;BR /&gt;14 prev_dt = put(today() - 1,yymmddn8.);&lt;BR /&gt;15 prev_date = put("&amp;amp;&amp;amp;prev_dt&amp;amp;",8.);&lt;BR /&gt;SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;.&lt;BR /&gt;WARNING: Apparent symbolic reference PREV_DT not resolved.&lt;BR /&gt;16 run;&lt;/P&gt;&lt;P&gt;NOTE: The data set TESTS.SYMPUT_001_DS0 has 1 observations and 4 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;SYMBOLGEN: Macro variable CURR_DT resolves to 20211213&lt;BR /&gt;17&lt;BR /&gt;18 %put &amp;amp;=curr_dt ;&lt;BR /&gt;CURR_DT=20211213&lt;BR /&gt;19 %put &amp;amp;=curr_date ;&lt;BR /&gt;SYMBOLGEN: Macro variable CURR_DATE resolves to &amp;amp;curr_dt&lt;BR /&gt;SYMBOLGEN: Macro variable CURR_DT resolves to 20211213&lt;BR /&gt;CURR_DATE=20211213&lt;BR /&gt;20 %put &amp;amp;=prev_date ;&lt;BR /&gt;SYMBOLGEN: Macro variable PREV_DATE resolves to &amp;amp;prev_dt&lt;BR /&gt;SYMBOLGEN: Macro variable PREV_DT resolves to 20211212&lt;BR /&gt;PREV_DATE=20211212&lt;BR /&gt;21 %put &amp;amp;=prev_dt ;&lt;BR /&gt;SYMBOLGEN: Macro variable PREV_DT resolves to 20211212&lt;BR /&gt;PREV_DT=20211212&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am thrown off (well, by a a lot things, but specifically) by the upper/lower case in the WARNING while the code has lower case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 22:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785898#M250865</guid>
      <dc:creator>dualice</dc:creator>
      <dc:date>2021-12-13T22:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785902#M250866</link>
      <description>&lt;P&gt;Error messages in a log normally come after the code that caused them. So not including the lines from the SAS log that come before the error message makes it impossible to see what lines of code caused the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS names are case insensitive. FRED and fred refer the same variable/dataset/libref/fileref/format/informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's look carefully at your first data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TESTS.SYMPUT_001_DS0;
  call symputx('curr_dt',put(today(),yymmddn8.),'G');
  call symput('curr_date', put('&amp;amp;&amp;amp;curr_dt&amp;amp;',8.));
  call symputx('prev_dt',put(today()-1,yymmddn8.),'G');
  call symput('prev_date', put('&amp;amp;&amp;amp;prev_dt&amp;amp;',8.));

  curr_dt = put(today(),yymmddn8.);
  curr_date = put('&amp;amp;&amp;amp;curr_dt&amp;amp;',8.);
  prev_dt = put(today() - 1,yymmddn8.);
  prev_date = put('&amp;amp;&amp;amp;prev_dt&amp;amp;',8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first statement seems kind of normal:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  call symputx('curr_dt',put(today(),yymmddn8.),'G');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will create a global macro variable named CURR_DT that is set to the series of digits like 20211213.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second one is really confused.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  call symput('curr_date', put('&amp;amp;&amp;amp;curr_dt&amp;amp;',8.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Because you are using single quotes instead of double quotes the macro processor will ignore the &amp;amp; macro triggers.&amp;nbsp; So you are calling the PUT() function and passing it a 10 character string.&amp;nbsp; You also give the PUT() function a numeric format.&amp;nbsp; But SAS is forgiving of type miss matches in a lot of places so it decides that you must have meant to use the character format $8. instead.&amp;nbsp; This means that the macro variable CURR_DATE is going to be set to the first 8 of those 10 character.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;amp;&amp;amp;curr_d&lt;/PRE&gt;
&lt;P&gt;What is it that you WANT to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you want to make one macro variable with today's date and another with a string of digits in YYYYMMDD style that you could use to build a filename?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  curr_dt = today();
  prev_dt = curr_dt - 1;
  format curr_dt prev_dt date9.;

  call symputx('curr_dt',curr_dt,'G');
  call symputx('prev_dt',prev_dt,'G');

  call symputx('curr_yyyymmdd',put(curr_dt,yymmddn8.),'G');
  call symputx('prev_yyyymmdd',put(prev_dt,yymmddn8.),'G');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;1343  %put &amp;amp;=curr_dt &amp;amp;=curr_yyyymmdd;
CURR_DT=22627 CURR_YYYYMMDD=20211213
1344  %put &amp;amp;=prev_dt &amp;amp;=prev_yyyymmdd;
PREV_DT=22626 PREV_YYYYMMDD=20211212

&lt;/PRE&gt;
&lt;P&gt;Dataset:&lt;/P&gt;
&lt;PRE&gt;Obs      curr_dt      prev_dt

 1     13DEC2021    12DEC2021

&lt;/PRE&gt;
&lt;P&gt;You can now use those macro variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data asof_&amp;amp;curr_yyyymmdd ;
  set have;
  where datevar &amp;lt;= &amp;amp;curr_dt;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 23:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785902#M250866</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-13T23:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785911#M250867</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for replying. The single quotes was the results of me flailing to figure out something that would work. So are the double &amp;amp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the original code that throws the same warnings:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;LIBNAME TESTS '/disk1/sand/SAS/workdir' ;

options mprint symbolgen;

data TESTS.SYMPUT_001_DS0;
    call symput('curr_dt',put(today(),yymmddn8.));
    call symput('curr_date', put("&amp;amp;curr_dt&amp;amp;",8.));
    call symput('prev_dt',put(today()-1,yymmddn8.));
    call symput('prev_date', put("&amp;amp;prev_dt&amp;amp;",8.));

    curr_dt     = put(today(),yymmddn8.);
    curr_date   = put("&amp;amp;curr_dt&amp;amp;",8.);
    prev_dt     = put(today() - 1,yymmddn8.);
    prev_date   = put("&amp;amp;prev_dt&amp;amp;",8.);
run;

%put &amp;amp;=curr_dt   ;
%put &amp;amp;=curr_date ;
%put &amp;amp;=prev_date ;
%put &amp;amp;=prev_dt   ;

data TESTS.SYMPUT_001_DS1;
    set TESTS.SYMPUT_001_DS0;
    length dt_num      8;
    length dt_str   $ 10;

    dt_num = &amp;amp;curr_dt;
    dt_str = '&amp;amp;curr_date&amp;amp;.';
    output;

    dt_num = &amp;amp;prev_dt;
    dt_str = '&amp;amp;prev_date&amp;amp;.';
    output;

    if &amp;amp;curr_dt &amp;gt; &amp;amp;prev_dt then output;
run;

data TESTS.SYMPUT_001_DS2;
    set TESTS.SYMPUT_001_DS1;
    where dt_num = &amp;amp;curr_dt;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 23:59:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785911#M250867</guid>
      <dc:creator>dualice</dc:creator>
      <dc:date>2021-12-13T23:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785913#M250868</link>
      <description>&lt;P&gt;Please explain what you are trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You did not correct the use of a numeric format when trying to PUT() a character string.&amp;nbsp; Do you want to use a character format? Or did you want to use PUT() to operate on a numeric value?&amp;nbsp; If the later what numeric value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You did not correct trying to use a macro variable to generate code before you have run any code to create it.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 00:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785913#M250868</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-14T00:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785915#M250869</link>
      <description>Sorry, yes. I want to use a character format.</description>
      <pubDate>Tue, 14 Dec 2021 00:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785915#M250869</guid>
      <dc:creator>dualice</dc:creator>
      <dc:date>2021-12-14T00:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785916#M250870</link>
      <description>&lt;P&gt;But WHAT is the code trying to do?&lt;/P&gt;
&lt;P&gt;What is the purpose of the macro variables? How will they be used? What is the purpose of the dataset the first data step is generating? How will it be used?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example why do want to make macro variable that contains the string 20131213?&amp;nbsp; You cannot use it as a date.&amp;nbsp; A number that large would represent a date way into the future.&amp;nbsp; You could use it create a TITLE statement or possibly as part of a filename.&amp;nbsp; But then why not use a more human readable form like 2013-12-13 or 2013_12_13 ?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 00:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/785916#M250870</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-14T00:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/786002#M250897</link>
      <description>&lt;P&gt;I want the date format as a string for two purposes...&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. for part of the name of a filename&lt;/P&gt;&lt;P&gt;2. the db I am eventually writing into contains a column that is a string that holds a date in that format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;all this aside, I don't understand why that warning is happening and how to fix the code so that it works.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 14:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/786002#M250897</guid>
      <dc:creator>dualice</dc:creator>
      <dc:date>2021-12-14T14:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/786003#M250898</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/409802"&gt;@dualice&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I want the date format as a string for two purposes...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. for part of the name of a filename&lt;/P&gt;
&lt;P&gt;2. the db I am eventually writing into contains a column that is a string that holds a date in that format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;all this aside, I don't understand why that warning is happening and how to fix the code so that it works.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I cannot figure out from this what you want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want a string that has today's date that you can use to generate a filename?&amp;nbsp; How do you want to format the string?&lt;/P&gt;
&lt;P&gt;You want to write to a database? Does that mean an external database, like Oracle or Redshift? Or a SAS dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a data step that will create two date variables and two character variables. It will also create two macro variables with strings in YYYYMMDD style.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TESTS.SYMPUT_001_DS0;
  length curr_dt prev_dt 8 curr_dt_string prev_dt_string $8;
  curr_dt = today();
  curr_dt_string = put(curr_dt,yymmddn8.);
  prev_dt = curr_dt -1 ;
  prev_dt_string = put(prev_dt,yymmddn8.);
  format curr_dt prev_dt date9.;

  call symputx('curr_dt',curr_dt_string);
  call symputx('prev_dt',prev_dt_string);
run;

%put CURR_DT = "&amp;amp;curr_dt";
%put PREV_DT = "&amp;amp;prev_dt";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Resulting Dataset:&lt;/P&gt;
&lt;PRE&gt;                                 curr_dt_    prev_dt_
Obs      curr_dt      prev_dt     string      string

 1     14DEC2021    13DEC2021    20211214    20211213
&lt;/PRE&gt;
&lt;P&gt;From SAS log&lt;/P&gt;
&lt;PRE&gt;1357  %put CURR_DT = "&amp;amp;curr_dt";
CURR_DT = "20211214"
1358  %put PREV_DT = "&amp;amp;prev_dt";
PREV_DT = "20211213"
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can then use those macro variables to generate code.&lt;/P&gt;
&lt;P&gt;For example let's say you want to subset some datasets name HAVE to just the observations where some character variable named DATE_STR matches the current date.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  where date_str = "&amp;amp;curr_dt";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or perhaps you want to write that data to file instead of a dataset and use the string of digits when creating the filename.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set have;
  where date_str = "&amp;amp;curr_dt";
  file "data_for_&amp;amp;curr_dt..txt" dsd dlm='|' ;
  put (_all_) (+0);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 14:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/786003#M250898</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-14T14:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/786469#M251114</link>
      <description>&lt;P&gt;Thank you for your responses. The fixes was exactly that - separating the single statements into two. the changed code, which now does not throw that warning is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LIBNAME TESTS '/disk1/sand/SAS/workdir' ;&lt;/P&gt;&lt;P&gt;options mprint symbolgen;&lt;/P&gt;&lt;P&gt;data TESTS.SYMPUT_001_DS0;&lt;BR /&gt;call symputx('curr_dt',put(today(),yymmddn8.),'G');&lt;BR /&gt;call symputx('prev_dt',put(today()-1,yymmddn8.),'G');&lt;/P&gt;&lt;P&gt;curr_dt = put(today(),yymmddn8.);&lt;BR /&gt;prev_dt = put(today() - 1,yymmddn8.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data TESTS.SYMPUT_001_DS1;&lt;BR /&gt;set TESTS.SYMPUT_001_DS0;&lt;BR /&gt;call symput('curr_date', put("&amp;amp;curr_dt",8.));&lt;BR /&gt;call symput('prev_date', put("&amp;amp;prev_dt",8.));&lt;/P&gt;&lt;P&gt;curr_date = put("&amp;amp;curr_dt",8.);&lt;BR /&gt;prev_date = put("&amp;amp;prev_dt",8.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%put &amp;amp;=curr_dt ;&lt;BR /&gt;%put &amp;amp;=curr_date ;&lt;BR /&gt;%put &amp;amp;=prev_date ;&lt;BR /&gt;%put &amp;amp;=prev_dt ;&lt;/P&gt;&lt;P&gt;data TESTS.SYMPUT_001_DS2;&lt;BR /&gt;set TESTS.SYMPUT_001_DS1;&lt;BR /&gt;length dt_num 8;&lt;BR /&gt;length dt_str $ 10;&lt;/P&gt;&lt;P&gt;dt_num = &amp;amp;curr_dt;&lt;BR /&gt;dt_str = "&amp;amp;curr_date";&lt;BR /&gt;output;&lt;/P&gt;&lt;P&gt;dt_num = &amp;amp;prev_dt;&lt;BR /&gt;dt_str = "&amp;amp;prev_date";&lt;BR /&gt;output;&lt;/P&gt;&lt;P&gt;if &amp;amp;curr_dt &amp;gt; &amp;amp;prev_dt then output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data TESTS.SYMPUT_001_DS3;&lt;BR /&gt;set TESTS.SYMPUT_001_DS2;&lt;BR /&gt;where dt_num = &amp;amp;curr_dt;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 13:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/786469#M251114</guid>
      <dc:creator>dualice</dc:creator>
      <dc:date>2021-12-17T13:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: WARNING: Apparent symbolic reference PREV_D not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/786471#M251115</link>
      <description>&lt;P&gt;I still cannot figure out what actual problem this code is supposed to be solving.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One warning.&amp;nbsp; It is better to calculate the date once.&amp;nbsp; If you call the DATE() function (also known as TODAY() function) multiple times and you happen to start right before midnight you might get different results.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TESTS.SYMPUT_001_DS0;
  today=today();
  curr_dt = put(today,yymmddn8.);
  prev_dt = put(today - 1,yymmddn8.);
  call symputx('curr_dt',curr_dt,'G');
  call symputx('prev_dt',prev_dt,'G');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 14:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WARNING-Apparent-symbolic-reference-PREV-D-not-resolved/m-p/786471#M251115</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-17T14:07:39Z</dc:date>
    </item>
  </channel>
</rss>

