<?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: How to create a database from scratch with macrovariables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317591#M69564</link>
    <description>&lt;P&gt;SAS has a prohibition against macrovariables in datalines/cards statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;varname1=&amp;amp;macvarnam1.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;varname2=&amp;amp;macvarnam2.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;varnameN=&amp;amp;macvarnamN.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;method to get around that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If need to poopulate more than one data row, and more than one variable per data row, you can assign and reference macro arrays like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%do i = 1 %to &amp;amp;n.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;%do j = 1 %to &amp;amp;m.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; varnam&amp;amp;j.=&amp;amp;&amp;amp;mvar&amp;amp;i._&amp;amp;j..;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;%end;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where n and m are the rows and columns of the data you want to load respectively and your macro variables are named from mvar1_1 to mvar&amp;amp;n._&amp;amp;m.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2016 13:09:54 GMT</pubDate>
    <dc:creator>Damien_Mather</dc:creator>
    <dc:date>2016-12-08T13:09:54Z</dc:date>
    <item>
      <title>How to create a database from scratch with macrovariables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317582#M69562</link>
      <description>&lt;P&gt;I want to create a database such as :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;data seuils_60;
    input seuil1;
    datalines;
    1080
    ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Except that I would like 1080 not to be an actual number, but a value stocked in a macrovariable. But when I try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;data seuils_60;
    input seuil1;
    datalines;
    &amp;amp;seuil_60_14
    ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get an error, although I can &lt;CODE&gt;%put&lt;/CODE&gt; my macrovariable (it exists).&lt;/P&gt;
&lt;P&gt;What would be the best way around ?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 12:47:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317582#M69562</guid>
      <dc:creator>Aboiron</dc:creator>
      <dc:date>2016-12-08T12:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a database from scratch with macrovariables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317589#M69563</link>
      <description>&lt;P&gt;data seuils_60;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; seuill=&amp;amp;seuil_60_14 ;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&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>Thu, 08 Dec 2016 13:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317589#M69563</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-12-08T13:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a database from scratch with macrovariables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317591#M69564</link>
      <description>&lt;P&gt;SAS has a prohibition against macrovariables in datalines/cards statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;varname1=&amp;amp;macvarnam1.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;varname2=&amp;amp;macvarnam2.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;varnameN=&amp;amp;macvarnamN.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;method to get around that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If need to poopulate more than one data row, and more than one variable per data row, you can assign and reference macro arrays like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%do i = 1 %to &amp;amp;n.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;%do j = 1 %to &amp;amp;m.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; varnam&amp;amp;j.=&amp;amp;&amp;amp;mvar&amp;amp;i._&amp;amp;j..;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;%end;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where n and m are the rows and columns of the data you want to load respectively and your macro variables are named from mvar1_1 to mvar&amp;amp;n._&amp;amp;m.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 13:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317591#M69564</guid>
      <dc:creator>Damien_Mather</dc:creator>
      <dc:date>2016-12-08T13:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a database from scratch with macrovariables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317594#M69565</link>
      <description>oops I meant to only type populate!</description>
      <pubDate>Thu, 08 Dec 2016 13:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317594#M69565</guid>
      <dc:creator>Damien_Mather</dc:creator>
      <dc:date>2016-12-08T13:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a database from scratch with macrovariables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317598#M69566</link>
      <description>&lt;P&gt;Sorry? &amp;nbsp;Where is the database in the question? &amp;nbsp;From what I can see is you want to assign a bit of text - macro is only text - to a variable. &amp;nbsp;So the question is why, as:&lt;/P&gt;
&lt;PRE&gt;data want;
  seuil1=1060;
run;&lt;/PRE&gt;
&lt;P&gt;Seems to be the code you want. &amp;nbsp;Without further information as to the why its hard to say, I mean what is&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;amp;seuil_60_14&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Why is it created, why does it contain data?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 13:30:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-database-from-scratch-with-macrovariables/m-p/317598#M69566</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-08T13:30:38Z</dc:date>
    </item>
  </channel>
</rss>

