<?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 new dataset in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456840#M29430</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input date $ sales bonus;
datalines;
20180101   100   50
20180108   102   51
20180115   110   53
;
run;
proc transpose data=have out=want;
id date;
var sales bonus;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 Apr 2018 12:27:49 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-04-24T12:27:49Z</dc:date>
    <item>
      <title>Creating new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456801#M29422</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a SAS dataset like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;Bonus&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20180101&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20180108&lt;/TD&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;51&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20180115&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;TD&gt;53&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All of variables are numeric format. Now, I would like to create a new SAS data set from previous dataset like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;01012018&lt;/TD&gt;&lt;TD&gt;01082018&lt;/TD&gt;&lt;TD&gt;15012018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bonus&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;51&lt;/TD&gt;&lt;TD&gt;53&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note that Date variables should be date format (ddmmyyyy).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 08:22:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456801#M29422</guid>
      <dc:creator>BURHAN_CIGDEM</dc:creator>
      <dc:date>2018-04-24T08:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456809#M29423</link>
      <description>&lt;P&gt;You cannot.&amp;nbsp; Variable names should start with an A-Z or underscore.&amp;nbsp; You can set the label to be the date and have variable name as d then date:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;data have;
  input date $ sales bonus;
datalines;
20180101   100   50
20180108   102   51
20180115   110   53
;
run;
proc transpose data=have out=inter;
  by date;
  var sales bonus;
run;
proc sort data=inter;
  by _name_ date;
run;
proc transpose data=inter out=want prefix=d;
  by _name_;
  var col1;
  id date;
  idlabel date;
run;
  &lt;/PRE&gt;
&lt;P&gt;Unless it is for an output file though I would really recommend against it.&amp;nbsp; You will find the data far harder to program against, just knowing what variables you have becomes a whole set of code in itself then.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 08:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456809#M29423</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-24T08:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456840#M29430</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input date $ sales bonus;
datalines;
20180101   100   50
20180108   102   51
20180115   110   53
;
run;
proc transpose data=have out=want;
id date;
var sales bonus;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Apr 2018 12:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456840#M29430</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-04-24T12:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456858#M29432</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;'s solution works, as long as you have properly set this option first:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options validvarname=any;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's what allows you to use variable names (such as the date values) that would not normally be permitted.&amp;nbsp; Also note that you will have to refer to your variable names a little differently going forward.&amp;nbsp; This will not work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var 20180101 20180108 20180115;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, you will need to use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var '20180101'n '20180108'n '20180115'n;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 13:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456858#M29432</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-24T13:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456868#M29433</link>
      <description>&lt;P&gt;Which in any production environment is to be used with extreme caution.&amp;nbsp; Any programming language is based on fundamental rules, it helps with programming for instance, and this option is effectively saying do whatever you like.&amp;nbsp; Even in that simple example coding has become far harder as you need quotes, the extra character, lose the ability to array them simply, or refer to them in lists.&amp;nbsp; Its just a very bad idea.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 14:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-new-dataset/m-p/456868#M29433</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-24T14:00:05Z</dc:date>
    </item>
  </channel>
</rss>

