<?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: SAS Programming 1: Essentials Demo: Filtering Rows Using Macro Variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985471#M43775</link>
    <description>&lt;P&gt;The rules of the macro values following the&amp;nbsp;&lt;SPAN&gt;token type makes sense. This is the part that I was missing. I was trying to figure out the type of data or the term you correctly pointed out to me is token type. The date from June 1980, please correct me if I'm wrong but that has to be in the quotation marks because it's making a calculation?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Mar 2026 18:35:56 GMT</pubDate>
    <dc:creator>ivarenho</dc:creator>
    <dc:date>2026-03-26T18:35:56Z</dc:date>
    <item>
      <title>SAS Programming 1: Essentials Demo: Filtering Rows Using Macro Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985454#M43773</link>
      <description>&lt;P&gt;I was hoping for help/ an explanation understanding why in the demo video that in the where statement the first macro is not in in double quotation marks but the other two are? I was trying to look up if the following two were string literals and maybe that had something to do with that and I searched the course and reviewed the syntax video but I'm still confused. I'll post an image of the video and I'm happy to go back and review lectures again, I just think I need some clarification.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-03-26 113734.png" style="width: 840px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113862i41516F534C367978/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-03-26 113734.png" alt="Screenshot 2026-03-26 113734.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2026 15:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985454#M43773</guid>
      <dc:creator>ivarenho</dc:creator>
      <dc:date>2026-03-26T15:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Programming 1: Essentials Demo: Filtering Rows Using Macro Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985466#M43774</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/480946"&gt;@ivarenho&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The substitutions that are made by macro variables need to match the type of the variable in the data set. The MaxWindMPH variable is a numeric variable, the Basin variable is a character variable, and StartDate is a numeric date value (number of days since Jan. 1, 1960).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember, you should always start with hard coded values before you start making macro variable substitutions. So if the original code is below. What do you notice? The value for MaxWindMPH is numeric token, so it does not have quotes around it. Basin is a character token, so it has double quotes around it and double quotes are required when you need a substitution for a character token. StartDate should be a numeric SAS date value, so the date constant (d) converts the values in double quotes to a numeric value that represents the number of days since Jan. 1, 1960.&lt;/P&gt;
&lt;PRE&gt;proc print data=pg1.storm_summary;
   where MaxWindMPH&amp;gt;100 and Basin="EP" and StartDate&amp;gt;="01Jun1980"d;
   var Basin Name StartDate EndDate MaxWindMPH;
run;&lt;/PRE&gt;
&lt;P&gt;In the code below, notice I used the SYMBOLGEN option to display the resolved values of the macro variables when the substitutions are made:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;20   options symbolgen;
21
22   %let WindSpeed=100;
23   %let BasinCode=EP;
24   %let Date=01Jun1980;
25
26   proc print data=pg1.storm_summary;
27      where MaxWindMPH&amp;gt;&amp;amp;WindSpeed and Basin="&amp;amp;BasinCode" and StartDate&amp;gt;="&amp;amp;Date"d;
SYMBOLGEN:  Macro variable WINDSPEED resolves to 100
SYMBOLGEN:  Macro variable BASINCODE resolves to EP
SYMBOLGEN:  Macro variable DATE resolves to 01Jun1980
28      var Basin Name StartDate EndDate MaxWindMPH;
29   run;

NOTE: There were 208 observations read from the data set PG1.STORM_SUMMARY.
      WHERE (MaxWindMPH&amp;gt;100) and (Basin='EP') and (StartDate&amp;gt;='01JUN1980'D);
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2026 17:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985466#M43774</guid>
      <dc:creator>D_Dunlap</dc:creator>
      <dc:date>2026-03-26T17:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Programming 1: Essentials Demo: Filtering Rows Using Macro Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985471#M43775</link>
      <description>&lt;P&gt;The rules of the macro values following the&amp;nbsp;&lt;SPAN&gt;token type makes sense. This is the part that I was missing. I was trying to figure out the type of data or the term you correctly pointed out to me is token type. The date from June 1980, please correct me if I'm wrong but that has to be in the quotation marks because it's making a calculation?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2026 18:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985471#M43775</guid>
      <dc:creator>ivarenho</dc:creator>
      <dc:date>2026-03-26T18:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Programming 1: Essentials Demo: Filtering Rows Using Macro Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985473#M43776</link>
      <description>&lt;P&gt;To make a DATE literal value you need text in a style that the DATE informat can understand enclosed in quotes and suffixed with the letter D.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'01JAN1980'd
"1jan80"d
"01-jan-1980"D&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could also just supply the actual number of days since start of 1960.&lt;/P&gt;
&lt;PRE&gt;7305&lt;/PRE&gt;
&lt;P&gt;But that is a lot harder for humans to read or enter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't normally need to think about tokens or how SAS parses the code.&amp;nbsp; Instead you just need to remember that the macro processor is just a normal text pre-processor.&amp;nbsp; The code that results once the macro processor is finished needs to be actual valid SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2026 02:41:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985473#M43776</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-03-27T02:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Programming 1: Essentials Demo: Filtering Rows Using Macro Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985478#M43777</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/480946"&gt;@ivarenho&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;The date from June 1980, please correct me if I'm wrong but that has to be in the quotation marks because it's making a calculation?&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Certain types of calculations can be done in SAS without quotation marks. It depends on whether or not quotation marks are required to create valid SAS code. In some cases, quotation marks are invalid at that point in the SAS code and will cause SAS to generate errors.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;This is why&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5008"&gt;@D_Dunlap&lt;/a&gt;&amp;nbsp;said you really should first generate working SAS code without macros variables, and hard-code the values that the macro variable will take — and if it works without quotes, then you don't need to quotes when you use the macro variable. If it doesn't work unless you put the quotes in, then you need the quotes when you use a macro variable. This is why&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;said "The code that results once the macro processor is finished needs to be actual valid SAS code." So please, do yourself a favor and first create working (emphasis on "working") code without macro variables and hard coded values where the macro variables will go. Then using the macro variables correctly will be a much easier task.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2026 11:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985478#M43777</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2026-03-27T11:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Programming 1: Essentials Demo: Filtering Rows Using Macro Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985629#M43780</link>
      <description>&lt;P&gt;I often will re-word what someone says to make sure I understand, I appreciate you explaining what was said by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5008"&gt;@D_Dunlap&lt;/a&gt;&amp;nbsp;, what you and they are both say is to make sure the code works before using it to create the marco variables. That makes sense to me. This way, if there is an error with the code before creating the macro, I can correct that error before creating the macro variable.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2026 14:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985629#M43780</guid>
      <dc:creator>ivarenho</dc:creator>
      <dc:date>2026-03-30T14:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Programming 1: Essentials Demo: Filtering Rows Using Macro Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985637#M43781</link>
      <description>&lt;P&gt;This is great to hear&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/480946"&gt;@ivarenho&lt;/a&gt;&amp;nbsp;. So many visitors only want the answer to their programming problem and learn nothing useful so next time they have similar problems. So many visitors to this forum receive the same advice about creating a working program without macro variables first, and they ignore the advice and move on to struggle mightily with macros.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2026 16:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Programming-1-Essentials-Demo-Filtering-Rows-Using-Macro/m-p/985637#M43781</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2026-03-30T16:01:52Z</dc:date>
    </item>
  </channel>
</rss>

