<?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: Creating Variables in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Creating-Variables/m-p/537925#M7110</link>
    <description>&lt;P&gt;Here a data step option to also populate a Year variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  country="UK";
  population_2010=10;
  population_2011=20;
  output;
  country="US";
  population_2010=15;
  population_2011=25;
  output;
run;
data want(drop=_: population_:);
  set have;
  length year $4 pop_count 8;
  array _pop {*} population_:;
  do _i=1 to dim(_pop);
    year=scan(vname(_pop[_i]),2,'_');
    pop_count=_pop[_i];
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 23 Feb 2019 02:32:17 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2019-02-23T02:32:17Z</dc:date>
    <item>
      <title>Creating Variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Creating-Variables/m-p/537598#M7093</link>
      <description>&lt;P&gt;I have uploaded a dataset with multiple variables into SAS Studio. These variables varies across time.&amp;nbsp;&lt;BR /&gt;For instance i need to create one variable population instead of 7 variables:&lt;/P&gt;&lt;P&gt;Population &amp;lt;- Population_2010 + Population_2011 + ....&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope someone can help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 06:21:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Creating-Variables/m-p/537598#M7093</guid>
      <dc:creator>Tobiasp94</dc:creator>
      <dc:date>2019-02-22T06:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Creating-Variables/m-p/537600#M7094</link>
      <description>&lt;P&gt;It is recommend to avoid data in variable-names. Having one variable with the year and another with the value allows easier usage of the data. If you have to create a dataset with those year-variables you need to post a data-step with datalines statement showing the data you have. This &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_self"&gt;post&lt;/A&gt; explains how to transform data into a data-step.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 06:30:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Creating-Variables/m-p/537600#M7094</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-02-22T06:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Creating-Variables/m-p/537612#M7095</link>
      <description>&lt;P&gt;Note I am assuming your data here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt;  country="UK";&lt;BR /&gt;  population_2010=10;&lt;BR /&gt;  population_2011=20;&lt;BR /&gt;  output;&lt;BR /&gt;  country="US";&lt;BR /&gt;  population_2010=15;&lt;BR /&gt;  population_2011=25;&lt;BR /&gt;  output;&lt;BR /&gt;run;&lt;BR /&gt;proc transpose data=have out=want;&lt;BR /&gt;  by country;&lt;BR /&gt;  var population_:;&lt;BR /&gt;run; &lt;/PRE&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>Fri, 22 Feb 2019 08:00:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Creating-Variables/m-p/537612#M7095</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-22T08:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Variables</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Creating-Variables/m-p/537925#M7110</link>
      <description>&lt;P&gt;Here a data step option to also populate a Year variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  country="UK";
  population_2010=10;
  population_2011=20;
  output;
  country="US";
  population_2010=15;
  population_2011=25;
  output;
run;
data want(drop=_: population_:);
  set have;
  length year $4 pop_count 8;
  array _pop {*} population_:;
  do _i=1 to dim(_pop);
    year=scan(vname(_pop[_i]),2,'_');
    pop_count=_pop[_i];
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Feb 2019 02:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Creating-Variables/m-p/537925#M7110</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-02-23T02:32:17Z</dc:date>
    </item>
  </channel>
</rss>

