<?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 Trying to create Headers using a variable followed by text. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-create-Headers-using-a-variable-followed-by-text/m-p/923871#M41431</link>
    <description>&lt;P&gt;Hi, I am trying to create a header for my table that reads "2023 Actual."&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The purpose of this is to compare what we spent in the prior year compared to the current year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My program prompts the user for the current year as a 4 digit numeric variable called "Vyear" which is the current year, or 2024 in this example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As of now, when I run the attached code the header reads as "2024-1 Actual" as text. (see attached image). My goal is to have the header "2023 Actual"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made the current year as numeric to avoid having to create an additional prompt that asks for what year it was last year in hopes that I could do Vyear(current year) -1 to return the prior year. Ex: 2024 would become 2023.&lt;/P&gt;&lt;PRE&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Supp.JPG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95433iB81C6A35944344AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Supp.JPG" alt="Supp.JPG" /&gt;&lt;/span&gt;%put &amp;amp;VYear;
%let VP = &amp;amp;Vyear. - 1;
%put &amp;amp;VP.;

%let VYearChar = %sysfunc(putn(&amp;amp;Vyear, 4.));
%let Budget = "&amp;amp;VYearChar. Budget";
%let Actual = "&amp;amp;VYearChar. Actual";

%let V_Act = "&amp;amp;VP. Actual";

DATA Work.BotL;
Set WORK.Month_PYtoCYActuals;

Header = &amp;amp;V_Act.; MTD = 'PY Month Actual'n; OUTPUT;
Header = &amp;amp;Actual.; MTD = 'CY Month Actual'n; OUTPUT;
Header = 'Variance $'; MTD = '$ Variance'n; OUTPUT;

drop 'PY Month Actual'n;
drop 'CY Month Actual'n;
drop '$ variance'n;

RUN;


DATA Work.BotL;
Set WORK.Month_PYtoCYActuals;

Header = &amp;amp;V_Act.; MTD = 'PY Month Actual'n; OUTPUT;
Header = &amp;amp;Actual.; MTD = 'CY Month Actual'n; OUTPUT;
Header = 'Variance $'; MTD = '$ Variance'n; OUTPUT;

drop 'PY Month Actual'n;
drop 'CY Month Actual'n;
drop '$ variance'n;

RUN;&lt;/PRE&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>Wed, 10 Apr 2024 21:05:31 GMT</pubDate>
    <dc:creator>CSB35</dc:creator>
    <dc:date>2024-04-10T21:05:31Z</dc:date>
    <item>
      <title>Trying to create Headers using a variable followed by text.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-create-Headers-using-a-variable-followed-by-text/m-p/923871#M41431</link>
      <description>&lt;P&gt;Hi, I am trying to create a header for my table that reads "2023 Actual."&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The purpose of this is to compare what we spent in the prior year compared to the current year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My program prompts the user for the current year as a 4 digit numeric variable called "Vyear" which is the current year, or 2024 in this example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As of now, when I run the attached code the header reads as "2024-1 Actual" as text. (see attached image). My goal is to have the header "2023 Actual"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made the current year as numeric to avoid having to create an additional prompt that asks for what year it was last year in hopes that I could do Vyear(current year) -1 to return the prior year. Ex: 2024 would become 2023.&lt;/P&gt;&lt;PRE&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Supp.JPG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95433iB81C6A35944344AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Supp.JPG" alt="Supp.JPG" /&gt;&lt;/span&gt;%put &amp;amp;VYear;
%let VP = &amp;amp;Vyear. - 1;
%put &amp;amp;VP.;

%let VYearChar = %sysfunc(putn(&amp;amp;Vyear, 4.));
%let Budget = "&amp;amp;VYearChar. Budget";
%let Actual = "&amp;amp;VYearChar. Actual";

%let V_Act = "&amp;amp;VP. Actual";

DATA Work.BotL;
Set WORK.Month_PYtoCYActuals;

Header = &amp;amp;V_Act.; MTD = 'PY Month Actual'n; OUTPUT;
Header = &amp;amp;Actual.; MTD = 'CY Month Actual'n; OUTPUT;
Header = 'Variance $'; MTD = '$ Variance'n; OUTPUT;

drop 'PY Month Actual'n;
drop 'CY Month Actual'n;
drop '$ variance'n;

RUN;


DATA Work.BotL;
Set WORK.Month_PYtoCYActuals;

Header = &amp;amp;V_Act.; MTD = 'PY Month Actual'n; OUTPUT;
Header = &amp;amp;Actual.; MTD = 'CY Month Actual'n; OUTPUT;
Header = 'Variance $'; MTD = '$ Variance'n; OUTPUT;

drop 'PY Month Actual'n;
drop 'CY Month Actual'n;
drop '$ variance'n;

RUN;&lt;/PRE&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>Wed, 10 Apr 2024 21:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-create-Headers-using-a-variable-followed-by-text/m-p/923871#M41431</guid>
      <dc:creator>CSB35</dc:creator>
      <dc:date>2024-04-10T21:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create Headers using a variable followed by text.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-create-Headers-using-a-variable-followed-by-text/m-p/923873#M41432</link>
      <description>&lt;P&gt;The SAS macro language is intended to generate text. As such it does not do any arithmetic unless you tell it to.&lt;/P&gt;
&lt;P&gt;If the values you are working with are integer then you can use the %eval function to do the arithmetic (or logical comparisons):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let vyear= 2024;
%let VP = %eval(&amp;amp;Vyear. - 1);
%put &amp;amp;VP.;&lt;/PRE&gt;
&lt;P&gt;If your values involve decimals, i.e. floating point numbers, the function is %sysevalf, which has some options as the representation of the result so read up on it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2024 21:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-create-Headers-using-a-variable-followed-by-text/m-p/923873#M41432</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-10T21:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create Headers using a variable followed by text.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-create-Headers-using-a-variable-followed-by-text/m-p/923874#M41433</link>
      <description>Thank you, this worked! My numbers are integers.</description>
      <pubDate>Wed, 10 Apr 2024 21:24:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-create-Headers-using-a-variable-followed-by-text/m-p/923874#M41433</guid>
      <dc:creator>CSB35</dc:creator>
      <dc:date>2024-04-10T21:24:49Z</dc:date>
    </item>
  </channel>
</rss>

