<?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: Name Column as previous month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Name-Column-as-previous-month/m-p/472902#M121300</link>
    <description>&lt;P&gt;I highly recommend you don't.&amp;nbsp; Column names are something for a programming point of view, not for a user looking at the data.&amp;nbsp; As you have found, just creating the variable like that is a real pain, now imagine trying to program with that, each datastep you need to find out what variables are present, what they are called etc.&amp;nbsp; It will just make all programming far more complicated and less robust.&amp;nbsp; If you need the information for a report, then put this information in the Label - which is the part for free text to show what the variable contains, and give the variable a logical simple name.&lt;/P&gt;
&lt;P&gt;I would also highly recommend not to use named literals:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;t1.'MAP_ID'n,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;These are really only there for the rare time that you need to access a non-standard variable name from a bad data source such as Excel.&amp;nbsp; Normal programming should use SAS compliant variable names - as you will have been shown through all basic courses - to make coding far simpler, easier to read, and more robust.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please avoid shouting code also.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data _null_;&lt;BR /&gt; call symputx('my',put(intnx('month',today(),1),monyy7.));&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sql;
  create table map_validation as
  select  distinct
          t1.map_id,
          count(t1.mpxn) as &amp;amp;my.
  from    zz_prc_output t1
  group by t1.map_id;
quit;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I tend to do things like that in a datastep as the syntax is easier to read than a whole stream of % and &amp;amp;'s.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jun 2018 08:28:07 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-06-25T08:28:07Z</dc:date>
    <item>
      <title>Name Column as previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Name-Column-as-previous-month/m-p/472898#M121298</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to name a column as the previous month, with the year if possible, but at this point just the month would be a big help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the working code I have, however, this only names the column the current month.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried INTNX but to no avail.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE MAP_VALIDATION AS&lt;BR /&gt;SELECT DISTINCT t1.'MAP_ID'n,&lt;BR /&gt;(COUNT(t1.MPXN)) AS %sysfunc(today(),monyy7.)&lt;BR /&gt;FROM ZZ_PRC_OUTPUT t1&lt;BR /&gt;GROUP BY t1.'MAP_ID'n;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be MUCH appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 08:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Name-Column-as-previous-month/m-p/472898#M121298</guid>
      <dc:creator>Sassy-Grrl</dc:creator>
      <dc:date>2018-06-25T08:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Name Column as previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Name-Column-as-previous-month/m-p/472902#M121300</link>
      <description>&lt;P&gt;I highly recommend you don't.&amp;nbsp; Column names are something for a programming point of view, not for a user looking at the data.&amp;nbsp; As you have found, just creating the variable like that is a real pain, now imagine trying to program with that, each datastep you need to find out what variables are present, what they are called etc.&amp;nbsp; It will just make all programming far more complicated and less robust.&amp;nbsp; If you need the information for a report, then put this information in the Label - which is the part for free text to show what the variable contains, and give the variable a logical simple name.&lt;/P&gt;
&lt;P&gt;I would also highly recommend not to use named literals:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;t1.'MAP_ID'n,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;These are really only there for the rare time that you need to access a non-standard variable name from a bad data source such as Excel.&amp;nbsp; Normal programming should use SAS compliant variable names - as you will have been shown through all basic courses - to make coding far simpler, easier to read, and more robust.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please avoid shouting code also.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data _null_;&lt;BR /&gt; call symputx('my',put(intnx('month',today(),1),monyy7.));&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sql;
  create table map_validation as
  select  distinct
          t1.map_id,
          count(t1.mpxn) as &amp;amp;my.
  from    zz_prc_output t1
  group by t1.map_id;
quit;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I tend to do things like that in a datastep as the syntax is easier to read than a whole stream of % and &amp;amp;'s.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 08:28:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Name-Column-as-previous-month/m-p/472902#M121300</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-25T08:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Name Column as previous month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Name-Column-as-previous-month/m-p/472903#M121301</link>
      <description>Wow, thank you so much for that quick reply.</description>
      <pubDate>Mon, 25 Jun 2018 08:39:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Name-Column-as-previous-month/m-p/472903#M121301</guid>
      <dc:creator>Sassy-Grrl</dc:creator>
      <dc:date>2018-06-25T08:39:19Z</dc:date>
    </item>
  </channel>
</rss>

