<?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 flag dataset name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9710#M569</link>
    <description>I am looking for an alternative to make below program in one datastep or any shorter. I've got mulitple datasets and trying to append all tables in one step. &lt;BR /&gt;
&lt;BR /&gt;
data test1; set sashelp.class; flag = '30 days';run;&lt;BR /&gt;
data test2; set sashelp.class; flag = '90 days';run;&lt;BR /&gt;
data test3; set sashelp.class; flag = 'over all';run;&lt;BR /&gt;
data all;&lt;BR /&gt;
set test1 test2 test3;run;&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
    <pubDate>Mon, 14 Feb 2011 22:03:46 GMT</pubDate>
    <dc:creator>nj_sas</dc:creator>
    <dc:date>2011-02-14T22:03:46Z</dc:date>
    <item>
      <title>flag dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9710#M569</link>
      <description>I am looking for an alternative to make below program in one datastep or any shorter. I've got mulitple datasets and trying to append all tables in one step. &lt;BR /&gt;
&lt;BR /&gt;
data test1; set sashelp.class; flag = '30 days';run;&lt;BR /&gt;
data test2; set sashelp.class; flag = '90 days';run;&lt;BR /&gt;
data test3; set sashelp.class; flag = 'over all';run;&lt;BR /&gt;
data all;&lt;BR /&gt;
set test1 test2 test3;run;&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Mon, 14 Feb 2011 22:03:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9710#M569</guid>
      <dc:creator>nj_sas</dc:creator>
      <dc:date>2011-02-14T22:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: flag dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9711#M570</link>
      <description>* many ways to do it.  Simple approach below;&lt;BR /&gt;
&lt;BR /&gt;
data all;&lt;BR /&gt;
  set test1(in=intest1) test2(in=intest2) test3(in=intest3) ;&lt;BR /&gt;
  if intest1 then flag='30 days';&lt;BR /&gt;
  else if intest2 then flag='90 days';&lt;BR /&gt;
  else if intest3 then flag='over all';&lt;BR /&gt;
  run;</description>
      <pubDate>Mon, 14 Feb 2011 22:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9711#M570</guid>
      <dc:creator>jdopdyke</dc:creator>
      <dc:date>2011-02-14T22:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: flag dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9712#M571</link>
      <description>Hi:&lt;BR /&gt;
  There is no real reason to create TEST1, TEST2 and TEST3 unless your production process needs all 3 datasets. You could just create ALL with 1 DATA step program as shown in the comparison of your original code with the alternative code (if you want to create ALL from the same input dataset (such as SASHELP.CLASS).&lt;BR /&gt;
 &lt;BR /&gt;
If TEST1, TEST2 and TEST3 &lt;I&gt;&lt;U&gt;already&lt;/U&gt;&lt;/I&gt;&lt;U&gt;&lt;/U&gt; exist then you can use the previous suggestion with the IN= option to set the value of the FLAG variable.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
** Your ORIGINAL method;&lt;BR /&gt;
9781   data test1; set sashelp.class; flag = '30 days '; run;&lt;BR /&gt;
                        &lt;BR /&gt;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;
NOTE: The data set WORK.TEST1 has 19 observations and 6 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
                               &lt;BR /&gt;
9782   data test2; set sashelp.class; flag = '90 days '; run;&lt;BR /&gt;
                             &lt;BR /&gt;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;
NOTE: The data set WORK.TEST2 has 19 observations and 6 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
                            &lt;BR /&gt;
9783   data test3; set sashelp.class; flag = 'over all'; run;&lt;BR /&gt;
                     &lt;BR /&gt;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;
NOTE: The data set WORK.TEST3 has 19 observations and 6 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
                                &lt;BR /&gt;
&lt;BR /&gt;
9784&lt;BR /&gt;
9785   data all;&lt;BR /&gt;
9786   set test1 test2 test3;&lt;BR /&gt;
9787   run;&lt;BR /&gt;
                        &lt;BR /&gt;
NOTE: There were 19 observations read from the data set WORK.TEST1.&lt;BR /&gt;
NOTE: There were 19 observations read from the data set WORK.TEST2.&lt;BR /&gt;
NOTE: There were 19 observations read from the data set WORK.TEST3.&lt;BR /&gt;
NOTE: The data set WORK.ALL has 57 observations and 6 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
                             &lt;BR /&gt;
                     &lt;BR /&gt;
** ALTERNATIVE Method creates WORK.ALL2;         &lt;BR /&gt;
9788&lt;BR /&gt;
9789&lt;BR /&gt;
9790   data all2;&lt;BR /&gt;
9791      set sashelp.class;&lt;BR /&gt;
9792      length flag $8;&lt;BR /&gt;
9793      ** 1 obs for 30 days;&lt;BR /&gt;
9794      flag='30 days';&lt;BR /&gt;
9795      output;&lt;BR /&gt;
9796&lt;BR /&gt;
9797      ** 1 obs for 90 days;&lt;BR /&gt;
9798      flag = '90 days';&lt;BR /&gt;
9799      output;&lt;BR /&gt;
9800&lt;BR /&gt;
9801      ** 1 obs for overall;&lt;BR /&gt;
9802      flag='over all';&lt;BR /&gt;
9803      output;&lt;BR /&gt;
9804   run;&lt;BR /&gt;
                        &lt;BR /&gt;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;
NOTE: The data set WORK.ALL2 has 57 observations and 6 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.01 second&lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
      <pubDate>Mon, 14 Feb 2011 22:32:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9712#M571</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-02-14T22:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: flag dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9713#M572</link>
      <description>I think you would be interested in the 9.2 SET statement option&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
INDSNAME=variable &lt;BR /&gt;
creates and names a variable that stores the name of the SAS data set from&lt;BR /&gt;
which the current observation is read. The stored name can be a data set name or&lt;BR /&gt;
a physical name. The physical name is the name by which the operating&lt;BR /&gt;
environment recognizes the file.&lt;BR /&gt;
[/pre]</description>
      <pubDate>Mon, 14 Feb 2011 22:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9713#M572</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-02-14T22:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: flag dataset name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9714#M573</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
If you need to create the temporary data sets yo may find the next macro solution useful:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
%macro a;&lt;BR /&gt;
&lt;BR /&gt;
%do i=1 %to 3;&lt;BR /&gt;
&lt;BR /&gt;
data test&amp;amp;i;&lt;BR /&gt;
set sashelp.class;&lt;BR /&gt;
&lt;BR /&gt;
array f{3} $ 20 _temporary_ ('30 days','90 days','over all');&lt;BR /&gt;
&lt;BR /&gt;
flag=f{"&amp;amp;i"};&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%end;&lt;BR /&gt;
&lt;BR /&gt;
data all;&lt;BR /&gt;
set test:;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%mend a;&lt;BR /&gt;
&lt;BR /&gt;
%a&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Marius</description>
      <pubDate>Tue, 15 Feb 2011 09:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/flag-dataset-name/m-p/9714#M573</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-15T09:36:21Z</dc:date>
    </item>
  </channel>
</rss>

