<?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 Question about %Let in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Let/m-p/323146#M271160</link>
    <description>&lt;P&gt;** Original code without macro variables;&lt;BR /&gt;PROC FREQ DATA = sasdata.cats;&lt;BR /&gt;TABLES Origin;&lt;BR /&gt;TITLE 'Cat Breeds by = Origin’;&lt;BR /&gt;RUN;&lt;BR /&gt;PROC PRINT DATA = sasdata.cats;&lt;BR /&gt;WHERE Origin = 'Thailand';&lt;BR /&gt;TITLE 'Cat Breeds with Origin = Thailand';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a.Use %LET statements to create two macro variables: one to replace the variable name Origin, and another to replace the&lt;BR /&gt;data value ‘Thailand’.Use an option that will enable you to see the standard SAS statements generated by the macro processor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b. Use the macro variables to produce counts for the variable Derivation, and to list data for&lt;BR /&gt;breeds that were derived by mutation.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;c. Convert the code to a macro. Pass the values for the two macro variables into the macro as&lt;BR /&gt;parameters. Call the macro to produce counts for the variable Hair, and to list data for breeds&lt;BR /&gt;with long hair.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;d. Add programming to your macro from part c) that will save your output in a PDF file. Name&lt;BR /&gt;this file CatRpt, and append the filename with a suffix that is the name of the variable used in&lt;BR /&gt;the TABLES statement.&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;The following is my code for (a), but i can't print it successfully :S&amp;nbsp;&amp;nbsp; and for (B) (c) (d) i am completely lost &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;been stock on this questions for days &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let Origin=from;&lt;BR /&gt;%let Thailand=Island;&lt;BR /&gt;%macro coco;&lt;BR /&gt;PROC FREQ DATA = sec.cats;&lt;BR /&gt;TABLES Origin;&lt;BR /&gt;TITLE 'Cat Breeds by = Origin';&lt;BR /&gt;RUN;&lt;BR /&gt;PROC PRINT DATA = se.cats;&lt;BR /&gt;WHERE Origin = 'Thailand';&lt;BR /&gt;TITLE 'Cat Breeds with Origin = Thailand';&lt;BR /&gt;RUN;&lt;BR /&gt;%mend coco;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 07 Jan 2017 06:16:18 GMT</pubDate>
    <dc:creator>weiwei2392</dc:creator>
    <dc:date>2017-01-07T06:16:18Z</dc:date>
    <item>
      <title>Question about %Let</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Let/m-p/323146#M271160</link>
      <description>&lt;P&gt;** Original code without macro variables;&lt;BR /&gt;PROC FREQ DATA = sasdata.cats;&lt;BR /&gt;TABLES Origin;&lt;BR /&gt;TITLE 'Cat Breeds by = Origin’;&lt;BR /&gt;RUN;&lt;BR /&gt;PROC PRINT DATA = sasdata.cats;&lt;BR /&gt;WHERE Origin = 'Thailand';&lt;BR /&gt;TITLE 'Cat Breeds with Origin = Thailand';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a.Use %LET statements to create two macro variables: one to replace the variable name Origin, and another to replace the&lt;BR /&gt;data value ‘Thailand’.Use an option that will enable you to see the standard SAS statements generated by the macro processor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b. Use the macro variables to produce counts for the variable Derivation, and to list data for&lt;BR /&gt;breeds that were derived by mutation.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;c. Convert the code to a macro. Pass the values for the two macro variables into the macro as&lt;BR /&gt;parameters. Call the macro to produce counts for the variable Hair, and to list data for breeds&lt;BR /&gt;with long hair.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;d. Add programming to your macro from part c) that will save your output in a PDF file. Name&lt;BR /&gt;this file CatRpt, and append the filename with a suffix that is the name of the variable used in&lt;BR /&gt;the TABLES statement.&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;The following is my code for (a), but i can't print it successfully :S&amp;nbsp;&amp;nbsp; and for (B) (c) (d) i am completely lost &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;been stock on this questions for days &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let Origin=from;&lt;BR /&gt;%let Thailand=Island;&lt;BR /&gt;%macro coco;&lt;BR /&gt;PROC FREQ DATA = sec.cats;&lt;BR /&gt;TABLES Origin;&lt;BR /&gt;TITLE 'Cat Breeds by = Origin';&lt;BR /&gt;RUN;&lt;BR /&gt;PROC PRINT DATA = se.cats;&lt;BR /&gt;WHERE Origin = 'Thailand';&lt;BR /&gt;TITLE 'Cat Breeds with Origin = Thailand';&lt;BR /&gt;RUN;&lt;BR /&gt;%mend coco;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2017 06:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Let/m-p/323146#M271160</guid>
      <dc:creator>weiwei2392</dc:creator>
      <dc:date>2017-01-07T06:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Question about %Let</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Let/m-p/323147#M271161</link>
      <description>&lt;P&gt;A)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let varname = Origin;
%let country = Thailand;

PROC FREQ DATA = sasdata.cats;
TABLES &amp;amp;varname;
TITLE "Cat Breeds by = &amp;amp;country";
RUN;
PROC PRINT DATA = sasdata.cats;
WHERE &amp;amp;varname = "&amp;amp;country";
TITLE "Cat Breeds with &amp;amp;varname = &amp;amp;country ";
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;U&gt; pay attention&lt;/U&gt;: &amp;nbsp;&amp;amp;origin will insert your assignment by %let to this macro variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;use &lt;STRONG&gt;double&lt;/STRONG&gt; quotes in order that macro variable will be resolved to its content&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;when it is used as litteral&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;C) same as (A) can be done without %LET but by macro program with arguments:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro coco(varname,country);
PROC FREQ DATA = sasdata.cats;
TABLES &amp;amp;varname;
TITLE 'Cat Breeds by = Origin’;
RUN;
PROC PRINT DATA = sasdata.cats;
WHERE &amp;amp;varname = "&amp;amp;country";
TITLE "Cat Breeds with &amp;amp;varname = &amp;amp;country ";
RUN;
%mend coco;
%coco(origin,Thailand);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;D) In order to get a PDF report use&lt;STRONG&gt; ODS PDF file="&lt;/STRONG&gt;&amp;lt;path and file name with suffix&amp;gt;&lt;STRONG&gt;";&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;in front your code and add&amp;nbsp;&lt;STRONG&gt;ODS CLOSE;&amp;nbsp;&lt;/STRONG&gt; at end of the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try it and check results.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2017 07:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Let/m-p/323147#M271161</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-01-07T07:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Question about %Let</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Let/m-p/323148#M271162</link>
      <description>Thank you so much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Now its making more sense...i didnt what i was writing &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt; Now i am able to understand the logic behind it !</description>
      <pubDate>Sat, 07 Jan 2017 08:21:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Let/m-p/323148#M271162</guid>
      <dc:creator>weiwei2392</dc:creator>
      <dc:date>2017-01-07T08:21:57Z</dc:date>
    </item>
  </channel>
</rss>

