<?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: create a macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431250#M106633</link>
    <description>What do you want to do with the macro variables? What should they contain?&lt;BR /&gt;&lt;BR /&gt;The position of the output statement seems to be wrong.</description>
    <pubDate>Fri, 26 Jan 2018 13:03:37 GMT</pubDate>
    <dc:creator>error_prone</dc:creator>
    <dc:date>2018-01-26T13:03:37Z</dc:date>
    <item>
      <title>create a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431247#M106632</link>
      <description>&lt;P&gt;Data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;put &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; abc $3.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; qrs $3.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; xyz $5.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; do 1 to 20;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; abc="djsdfsdk";&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; qrs="sdui";&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; xyz="YHTyuh";&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;end;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need to create &amp;nbsp;macro variable for abc, qrs, xyz&lt;/P&gt;&lt;P&gt;Can anybody please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 12:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431247#M106632</guid>
      <dc:creator>pnp123</dc:creator>
      <dc:date>2018-01-26T12:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: create a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431250#M106633</link>
      <description>What do you want to do with the macro variables? What should they contain?&lt;BR /&gt;&lt;BR /&gt;The position of the output statement seems to be wrong.</description>
      <pubDate>Fri, 26 Jan 2018 13:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431250#M106633</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2018-01-26T13:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: create a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431251#M106634</link>
      <description>&lt;P&gt;For what purpose is this code? It makes very little sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the CALL SYMPUTX Routine to create macro variables in a data step&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 13:06:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431251#M106634</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-01-26T13:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: create a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431257#M106637</link>
      <description>&lt;P&gt;Before you even &lt;EM&gt;think&lt;/EM&gt; about dealing with the macro preprocessor, you need to get a grasp of basic SAS data step principles, which you very obviously have not yet managed to do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test;
     put  
      abc $3.
      qrs $3.
      xyz $5.; /* This put statement makes no sense, as the variables have no values yet */
 
    do 1 to 20;
      abc="djsdfsdk";
      qrs="sdui";
      xyz="YHTyuh";
   end; /* this do loop also makes no sense, as it just sets the same values 20 times in succession. Just a waste of CPU cycles */
output; /* this statement is not necessary, as the data step will perform an implicit output of it's own at the end of an iteration */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jan 2018 13:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431257#M106637</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-26T13:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: create a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431335#M106681</link>
      <description>&lt;P&gt;You create macro variables in a data step using CALL SYMPUTX().&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your question is too vague to answer, so given how you've stated it, this would be 'correct':&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let macro1=abc;
%let macro2=qrs;
%let macro3=xyz;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You should also look into how PROC SQL can create macro variables, it's quite efficient at doing so, check the documentation for the relevant section with full examples:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select name into :name1-
from sashelp.class;
quit;

%put &amp;amp;name1.;
%put &amp;amp;name19.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 16:19:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-macro-variable/m-p/431335#M106681</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-26T16:19:56Z</dc:date>
    </item>
  </channel>
</rss>

