<?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 SAS DI Studio : Append many tables into one Without dragging them from the Folders section in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/819256#M20386</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am fairly new to SAS DI Studio. I would like to append many tables together into one without dragging each one of them onto APPEND transformation on the Job canvas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd rather prefer a kind of "User written code" as a Job, the datasets concatenations being based on certain prefix of the datasets names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you in advance for your support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jun 2022 08:08:59 GMT</pubDate>
    <dc:creator>Zeus_Olympus</dc:creator>
    <dc:date>2022-06-21T08:08:59Z</dc:date>
    <item>
      <title>SAS DI Studio : Append many tables into one Without dragging them from the Folders section</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/819256#M20386</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am fairly new to SAS DI Studio. I would like to append many tables together into one without dragging each one of them onto APPEND transformation on the Job canvas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd rather prefer a kind of "User written code" as a Job, the datasets concatenations being based on certain prefix of the datasets names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you in advance for your support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 08:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/819256#M20386</guid>
      <dc:creator>Zeus_Olympus</dc:creator>
      <dc:date>2022-06-21T08:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI Studio : Append many tables into one Without dragging them from the Folders section</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/819259#M20387</link>
      <description>&lt;P&gt;Also what you're asking for could be done via user written code the DI way of doing things is using table metadata objects. That's what gives you the lineage on SAS metadata level.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can understand that you don't want n-append nodes. As an alternative what could work is using the SQL SET transformation. This should allow for a single node with all your source tables as input and a single target table as output. Just make sure that you configure things so it generates SQL&amp;nbsp;&lt;EM&gt;union corr all &lt;/EM&gt;code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With user written code and to still have some lineage on metadata level:&lt;/P&gt;
&lt;P&gt;You could connect all input table metadata to a user written code node and then use the generated macro variables with the table names in your user written code. This would then still support lineage on metadata table level (but no more on column level).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "sad story": If your physical source tables follow a naming pattern then it would be very easy to implement using SAS syntax only without any metadata involved. But it's then no more the DIS way and breaks metadata lineage and though a decision to be made with "open eyes".&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 08:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/819259#M20387</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-06-21T08:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI Studio : Append many tables into one Without dragging them from the Folders section</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/819271#M20388</link>
      <description>&lt;P&gt;If you have a fixed no of inputs, I would do the drag-and-drop stuff, just to keep it graphical, and have the lineage intact as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;mentions.&lt;/P&gt;
&lt;P&gt;However, if your sources are "identical" with perhaps a date, region or product differentiator, you could use a loop transform, and then use a macro variable in the input table(s) physical name. Less no of objects, and potentially you can run those appends in parallel if your target table engine permits (RDBMS, SPDS).&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 09:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/819271#M20388</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-06-21T09:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI Studio : Append many tables into one Without dragging them from the Folders section</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/819412#M20391</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/428067"&gt;@Zeus_Olympus&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you want an alternative to dragging all the tables to the job canvas, i suppose that the datasets are registered in metadata.&amp;nbsp;If that is the case, and the tables resides in the same library, there is a simple solution based on the use of one of the tables to represent them all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not best practice, and it is dangerous too. Without the lineage your input datasets have no impact, and somebody (like me) might decide to clean them out as obsolete. I will not recommend it, but I am not laying down policies for your site, so here we go:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="canvas.gif" style="width: 469px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72499i3BFDCE007062B2AE/image-size/large?v=v2&amp;amp;px=999" role="button" title="canvas.gif" alt="canvas.gif" /&gt;&lt;/span&gt;&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;
&lt;P&gt;&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First step is to create the job. Drag one table to the canvas, which one doesn't matter as long as it resides in the right library, because it is used only to get the libname assigned in the job. The table name including the libref is then accessible for the user written code in the macro variable &amp;amp;_INPUT, and library information&amp;nbsp; including data sets is also added to the SASHELP views.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second: Write the code for the User Written transformation. It uses the libref to access&amp;nbsp;the SASHELP.VMEMBER view and get a list of dataset names with a given prefix supplied in the code. Upcase because all information in the sashelp-tables is in uppercase.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dsnprefix = compare;

proc sql noprint;
	select catx('.',scan("&amp;amp;_INPUT",1,'.'),memname) into :memnamelist separated by ' '
	from sashelp.vmember
	where upcase(scan("&amp;amp;_INPUT",1,'.')) = libname and memname EQT upcase("&amp;amp;dsnprefix");
quit;

data &amp;amp;_OUTPUT;
	set &amp;amp;memnamelist;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It makes sense only if all input datasets have the same - or almost the same - structure. Variable lengths are taken from the first occurrence of any given variable, so if a following dataset have a longer variable with the same name, it will be truncated. Variables with the same name must also be of the same type, i.e. char or num.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Short, effecient, but definitely cutting corners.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 18:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/819412#M20391</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2022-06-21T18:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI Studio : Append many tables into one Without dragging them from the Folders section</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/820199#M20407</link>
      <description>&lt;P&gt;Dear Erik,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your suggestion and I get the beloww errors:&lt;/P&gt;&lt;P&gt;=================================================&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference _OUTPUT not resolved.&lt;BR /&gt;117&lt;BR /&gt;118 data &amp;amp;_OUTPUT;&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, /, ;, _DATA_, _LAST_, _NULL_.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;119 set &amp;amp;memnamelist;&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;WARNING: Apparent symbolic reference MEMNAMELIST not resolved.&lt;BR /&gt;ERROR: File WORK.MEMNAMELIST.DATA does not exist.&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, CUROBS, END, INDSNAME, KEY, KEYRESET, KEYS,&lt;BR /&gt;NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;===================================================&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't figure it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additionally I would like to add a couple of criteria in selecting the tables to be further concatenated into one&amp;nbsp; e.g.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... and memname like 'CV_%'&lt;BR /&gt;or memname like 'SD_%'&lt;BR /&gt;or memname like 'MN_%'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 07:12:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/820199#M20407</guid>
      <dc:creator>Zeus_Olympus</dc:creator>
      <dc:date>2022-06-24T07:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI Studio : Append many tables into one Without dragging them from the Folders section</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/820200#M20408</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/428067"&gt;@Zeus_Olympus&lt;/a&gt;&amp;nbsp;There is somewhere in the transformation a checkbox where you can select for the transformation to generate macro variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's also really always worth to look at the generated code as this tells you what's available.&lt;/P&gt;
&lt;P&gt;If you're using using written code then go for "&lt;EM&gt;user written body&lt;/EM&gt;" ...or how that's called. I remember there are two options for user written code - choose the one that still generates the header and footer macros.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 08:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/820200#M20408</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-06-24T08:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI Studio : Append many tables into one Without dragging them from the Folders section</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/820388#M20410</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/428067"&gt;@Zeus_Olympus&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am sorry to hear that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It all depends on one table coupled ti the transformation as input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First: Check that you have selected "User written body". As &amp;amp;_OUTPUT is undefined one suspects that you have choosen All user written&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="zeus1.gif" style="width: 727px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72742iAA67F8A7F390FEB5/image-size/large?v=v2&amp;amp;px=999" role="button" title="zeus1.gif" alt="zeus1.gif" /&gt;&lt;/span&gt;&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;
&lt;P&gt;&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&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;
&lt;P&gt;After that you should see these macro variables in the code pane:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zeus2.gif" style="width: 678px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72743i60C0D2C5EFA8DF12/image-size/large?v=v2&amp;amp;px=999" role="button" title="zeus2.gif" alt="zeus2.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The last part is to modify the code to select more than one prefix. The simplest solution is to drop the dsnprefix macro variable and use constants in the select, something like this, where you can add as many as necessary, as long as they are 3 chars long to match the substring:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
	select catx('.',scan("&amp;amp;_INPUT",1,'.'),memname) into :memnamelist separated by ' '
	from sashelp.vmember
	where upcase(scan("&amp;amp;_INPUT",1,'.')) = libname and substr(memname,1,3) in ('CV_', 'SD_', 'MN_');
quit;

data &amp;amp;_OUTPUT;
	set &amp;amp;memnamelist;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I hope this solves your problem.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2022 15:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/820388#M20410</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2022-06-25T15:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI Studio : Append many tables into one Without dragging them from the Folders section</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/820494#M20411</link>
      <description>&lt;P&gt;Thank you very much, ErikLund !!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still need quite a lot of work to start feeling comfortable with DI.&lt;/P&gt;&lt;P&gt;Υour clear and detailed help gives me a good boost.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 10:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-DI-Studio-Append-many-tables-into-one-Without-dragging-them/m-p/820494#M20411</guid>
      <dc:creator>Zeus_Olympus</dc:creator>
      <dc:date>2022-06-27T10:42:20Z</dc:date>
    </item>
  </channel>
</rss>

