<?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: Splitting a Table by Column Contents? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372055#M275914</link>
    <description>&lt;P&gt;Thanks, that's roughly what I'd gleaned from the other topics on the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I'm likely to have is that getting any change made to the server access will be pretty much impossible and any solution that involves too much messing around to get the results onto a normal Windows networked structure will defeat the purpose of what I'm trying to achieve. &amp;nbsp;I'll contact my Admin and see what they suggest, but it's unlikely to be a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;At the moment I would export one file as a step in the process, to a Windows network folder away from the SAS environment, then use an Excel VBA code to split it. &amp;nbsp;I want SAS to do this bit for me so that one click will update all of the resulting datasets. &amp;nbsp;The results are used as dataconnections for various user tools that we develop, but we develop and don't want to be spending resource updating data where it can be done automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess what I'm after is the code behind the 'Export {table} as a Step in Project wizard in in EG, but I've not been able to get to that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run the code, then manualy add the Export step that would still save time, but then re-running the code as the data updates will remove the Export steps wouldn't it? &amp;nbsp; Is it possible to add the Export Step to each table as it's created by using code perhaps?&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jun 2017 08:33:39 GMT</pubDate>
    <dc:creator>paulrockliffe</dc:creator>
    <dc:date>2017-06-30T08:33:39Z</dc:date>
    <item>
      <title>Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371554#M275897</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pretty much every dataset I produce has some common columns, these contain the Sector, Region and Office that the line of data is linked to. &amp;nbsp;Data is often distributed to a Sector, a Region or an Office and usually this is done by dumping the entire dataset to an Excel spreadsheet and using slicers etc to allow individuals to make their own decisions about which data cut they want. &amp;nbsp;This is all fairly new as a way of working and I'd like to improve things because often having a full data-cut causes security concerns or simply means there's too much data for antiquated machines to run comfortably.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to add a Code Node to my Enterprise Guide process flows that creates multiple tables, one for each &amp;lt;parameter&amp;gt; and filters each table by that parameter. &amp;nbsp;The parameters would be the Sector, the Region or the Office, so for example if I wanted to use the Region, I would end up with 8 output tables, one for each Region.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I could do that, that woujld be amazing. &amp;nbsp;But if it's relatively simple, I'd like to be able to use multiple parameters, as some times it would be very useful to break the data down further, for example a Region's data broken down by Sector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In most cases I would want to export the results to Excel, I don't have access to any of the services around that other than right-click, 'export results as a step in the process'. &amp;nbsp;So a code that incorporated the export would be really helpful too. &amp;nbsp;Obviously I'd need to specify a location in the Code Node and the export needs to be .csv as the way Enterpise Guide builds .xls files (the referencing between the different .xml files is either relative or the opposite I can't remember which) means they can't be used as Data Connections in Excel. &amp;nbsp;Data Connections are really useful for us as they allow us to build process flows that automatically update the Excel-based products that we deliver.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that all makes sense, but if any part isn't clear, just let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 07:37:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371554#M275897</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-29T07:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371558#M275898</link>
      <description>&lt;P&gt;To me, that would be a real case for stored processes. You can set prompts for the parameters (pre-populated with variable names) and then create the tables accordingly.&lt;/P&gt;
&lt;P&gt;Since prompts are also available in EG (and you can create a stored process from a node), that is the first path I'd follow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have a STP server?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basic code for splitting along parameters:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let indata=sashelp.cars;
%let outlib=work;
%let param=origin;

proc sort
  data=&amp;amp;indata (keep=&amp;amp;param)
  out=lookup
  nodupkey
;
by &amp;amp;param;
run;

data _null_;
call execute ('data ');
do until (eof1);
  set lookup end=eof1;
  call execute("&amp;amp;outlib.." !! trim(&amp;amp;param) !! ' ');
end;
call execute ("; set &amp;amp;indata.;");
do until(eof2);
  set lookup end=eof2;
  call execute("if &amp;amp;param = '" !! trim(&amp;amp;param) !! "' then output &amp;amp;outlib.." !! trim(&amp;amp;param) !! ';');
end;
call execute('run;');
stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;At the end you'll have three datasets in work, dynamically created from sashelp.cars. All parameters are supplied as macro variables, so you can easily define prompts for that. You could also use the same lookup dataset to create a single export step for every origin, using call execute and a where dataset condition in the proc export.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 08:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371558#M275898</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-29T08:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371561#M275899</link>
      <description>&lt;P&gt;Thanks, that's very helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm making this up as I go along really, so I don't know if I can store a process, but I'll look into that. &amp;nbsp;What's an STP Server?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again, really appreciate the help.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 08:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371561#M275899</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-29T08:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371563#M275900</link>
      <description>&lt;P&gt;Oh, in your code example I'm specifying the input data table. &amp;nbsp;Is there anyway to have that pick up whatever table the Code Node is linked to? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 08:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371563#M275900</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-29T08:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371564#M275901</link>
      <description>&lt;P&gt;In a BI Server environment (meaning you have a metadata server, application servers and a web interface to them), one of the elements is a stored process server. This means you have one or more SAS processes waiting, and when a request is made, the code for the STP is fetched and executed. Output from that process can be an output stream (eg HTML). Through the web interface, people can request STPs for execution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A good starting point is here: &lt;A href="https://support.sas.com/documentation/cdl/en/stpug/68399/HTML/default/viewer.htm#p0ct3m137hug02n1lquwpbpggo5w.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/stpug/68399/HTML/default/viewer.htm#p0ct3m137hug02n1lquwpbpggo5w.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 08:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371564#M275901</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-29T08:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371566#M275902</link>
      <description>&lt;P&gt;Having a look around, I can open Stored Processes, and I've found a load in a folder so it looks like that might be an option, so long as I can save to that folder. &amp;nbsp;That'll depend on permissions, but also whether I'm allowed to use the folder. &amp;nbsp;I'll investigate. &amp;nbsp;In the mean time, if I get the code to work, I can easily convert that into a Stored Process?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 08:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371566#M275902</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-29T08:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371569#M275903</link>
      <description>&lt;P&gt;A code node does not have dedicated "input data" or "output data" parameters like other nodes. That is because there is no way how EG could know beforehand if your code actually needs or creates data.&lt;/P&gt;
&lt;P&gt;For this you will have to rely on defined user prompts.&lt;/P&gt;
&lt;P&gt;A quick introduction to user prompts can be found here: &lt;A href="http://support.sas.com/resources/papers/proceedings13/028-2013.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings13/028-2013.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 08:19:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371569#M275903</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-29T08:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371573#M275904</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/110699"&gt;@paulrockliffe&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Having a look around, I can open Stored Processes, and I've found a load in a folder so it looks like that might be an option, so long as I can save to that folder. &amp;nbsp;That'll depend on permissions, but also whether I'm allowed to use the folder. &amp;nbsp;I'll investigate. &amp;nbsp;In the mean time, if I get the code to work, I can easily convert that into a Stored Process?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There are several steps involved:&lt;/P&gt;
&lt;P&gt;- identify which nodes in a EG project will have to go into one STP&lt;/P&gt;
&lt;P&gt;- get the code from these nodes and combine them into one code node, or have them in one process flow&lt;/P&gt;
&lt;P&gt;- define the user prompts and use the results of the prompts in the nodes or the code&lt;/P&gt;
&lt;P&gt;- once that works, create the stored process from that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Requirements&lt;/P&gt;
&lt;P&gt;- you need a physical location (a "stored process repository") on the server where the stored process code will be stored (you and sassrv need read/write/execute permissions - OS level - there)&lt;/P&gt;
&lt;P&gt;- you need a folder in metadata where the stored process definition will be stored. My Folder can be used, but if you want to share your STP, a folder in "Shared Data" is needed. The necessary metadata permissions are required there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For most of the tasks, Enterprise Guide is a good helper. Start small (think "hello world"), and move to more complex STPs from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since a BI server usually includes a web component, trying&lt;/P&gt;
&lt;PRE&gt;http://your_sas_server:7980/SASStoredProcess&lt;/PRE&gt;
&lt;P&gt;should lead you to the web interface for stored processes.&lt;/P&gt;
&lt;P&gt;7980 is the default port for the SAS web server as delivered with 9.4&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 08:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371573#M275904</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-29T08:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371628#M275905</link>
      <description>&lt;P&gt;OK, I've made a start with getting this to work within my setup and with a table that includes my population.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got it working with Office as the Parameter, but where the Office has two words (eg Castle House) in the name it is creating two identical tables, one named Castle, the other House. &amp;nbsp;Is that an easy fix as it then causes problems dealing with the data down-stream. &amp;nbsp;I've got two Regions with London in the name, this results on the code stoping once it's created the first table called "London".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible for the code to start by deleting any tables it's already created; running it a second time causes errors because tables already exist? &amp;nbsp;The error is&amp;nbsp;ERROR: Data set WORK.LONDON is already open for output. &amp;nbsp;I've tried deleting the tables that are visible on the Process Flow, but they remain in WORK, so that doens't remove the error. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 11:48:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371628#M275905</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-29T11:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371639#M275906</link>
      <description>&lt;P&gt;When you prepare the lookup table, you can create two variables; one for the actual contents of your parameter variable, and the other with a value derived from that that contains a valid SAS name (no blanks or special characters).&lt;/P&gt;
&lt;P&gt;If it's not that easy to create valid SAS names, consider just using &amp;amp;param.001, &amp;amp;param.002 and so on (just the name of the parameter and a sequential number), as these will surely be valid.&lt;/P&gt;
&lt;P&gt;The problem with the locks should be fixed if you set your Enterprise Guide to not automatically open resulting datasets for display.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 12:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371639#M275906</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-29T12:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371661#M275907</link>
      <description>&lt;P&gt;Thanks, sorry do you mind explaining how I add the second column to the Lookup table created by the Proc Sort?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm very new to SQL and can follow what you've done but don't know how to add another variable when your code isn't adding the first variable, just keeping something that was already there.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 12:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371661#M275907</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-29T12:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371670#M275908</link>
      <description>&lt;P&gt;How you solve the problem of creating valid SAS names depends on the data you have. So have to apply a hefty dose of Maxim 3 (Know your data) to the problem. Do a proc freq on the variables in question, and see if a simple replacement of blanks with underlines solves it without creating unwanted similar values.&lt;/P&gt;
&lt;P&gt;A first attempt might look like that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let indata=sashelp.baseball;
%let outlib=work;
%let param=team;

proc sort
  data=&amp;amp;indata (keep=&amp;amp;param)
  out=lookup
  nodupkey
;
by &amp;amp;param;
run;

data lookup;
set lookup;
vname = translate(trim(&amp;amp;param),'_',' ');
run;

data _null_;
call execute ('data ');
do until (eof1);
  set lookup end=eof1;
  call execute("&amp;amp;outlib.." !! trim(vname) !! ' ');
end;
call execute ("; set &amp;amp;indata.;");
do until(eof2);
  set lookup end=eof2;
  call execute("if &amp;amp;param = '" !! trim(&amp;amp;param) !! "' then output &amp;amp;outlib.." !! trim(vname) !! ';');
end;
call execute('run;');
stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If it's hard to create valid dataset names (special characters etc.), the intermediate step for preparing lookup might be changed to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data lookup;
set lookup;
vname = "&amp;amp;param" !! put(_n_,z4.);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now the datasets will be numbered, so you will have to rely on the lookup dataset to tell you which dataset belongs where.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 13:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371670#M275908</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-29T13:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371673#M275909</link>
      <description>&lt;P&gt;Thanks, I'll take a look at that. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is only going to be split by three columns, all contain only names of either a Region, Office, or Sector. &amp;nbsp;There's something like 10 offices, 8 regions and 10 sectors and most are single words, though there are some with multiples words separated by a space and a few where there's an ampersand in there. &amp;nbsp;To get a valid SAS name I'd need to transform the contents by deleting ampersands, removeing double spaces and then replacing spaces with underscores. &amp;nbsp;That would cover every possible eventuality for the data I have. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or I could get the chap that builds the table I'm using to modify it so that it only contains valid results, that would robably be easiest!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 13:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371673#M275909</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-29T13:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371697#M275910</link>
      <description>&lt;P&gt;Right, got that working I think, though it was creating some data set names that are longer than 32 characters, so I've had to use substr to knock the end of the names. &amp;nbsp;I cna't work out how to remove an ampersand without ending up with two underscores next to each other, but that's a minor problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know how I go about getting each output table to automatically export to a folder as a .csv file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I presume if I use prompts to control the code node that the only way to be able to easily apply the code in a new project is to use the Stored Process?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again, this has been a great help!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 14:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/371697#M275910</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-29T14:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372013#M275911</link>
      <description>&lt;P&gt;The lookup file created in my last version already contains the name of the dataset, which can also be used as a valid filename for the OS.&lt;/P&gt;
&lt;P&gt;So you can use it to dynamically create the export steps:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let outpath=/somewhere/subdir/;

data _null_;
set lookup;
call execute("proc export data=&amp;amp;outlib.." !! trim(vname) !! " outfile='&amp;amp;outpath." !! trim(vname) !! ".csv' dbms=csv; run;");
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jun 2017 06:16:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372013#M275911</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-30T06:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372045#M275912</link>
      <description>&lt;P&gt;Thanks, I'm able to get that to work, but I've hit a problem; the code is trying to write the .csv files to outpath as if it is sat on the SAS Server under SASCompute. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't have access to any of the file structure under SASCompute and need to export to a local drive, eg C:\ SASResults\ThisProject or similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm going to have a Google around, but do you have a quick fix?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit; it's exactly this issue here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Unable-to-export-data-to-local-folders-PROC-EXPORT-in-SAS-EG/td-p/159122" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Unable-to-export-data-to-local-folders-PROC-EXPORT-in-SAS-EG/td-p/159122&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 08:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372045#M275912</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-30T08:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372048#M275913</link>
      <description>&lt;P&gt;If you want to write from SAS code to any location, that location must be "visible" to the SAS process.&lt;/P&gt;
&lt;P&gt;So you can either write to a local directory on the SAS server, or a remote directory that is mounted on the SAS server.&lt;/P&gt;
&lt;P&gt;If you want the files written from SAS code (not files created by Enterprise Guide after EG has donwloaded them internally from the SAS server) to be immediately accessible from your desktop, you have several options:&lt;/P&gt;
&lt;P&gt;- have a share set up on the SAS server, and mount that on your desktop&lt;/P&gt;
&lt;P&gt;- have a common share mounted on both the SAS server and the desktop&lt;/P&gt;
&lt;P&gt;- have a share from your desktop mounted on the SAS server&lt;/P&gt;
&lt;P&gt;- have some kind of FTP/SFTP server running on your desktop, and use filename FTP/SFTP in the SAS program&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also make it two steps, storing to a location on the SAS server where you have write access, and then use a file transfer client (or EG itself) to download to your desktop. Since a workspace server requires the presence of a home directory (which is visible to you under Files in the Server List), you can store the files there for retrieval. The file/pathname syntax depends on the operating system of the SAS server.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 08:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372048#M275913</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-30T08:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372055#M275914</link>
      <description>&lt;P&gt;Thanks, that's roughly what I'd gleaned from the other topics on the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I'm likely to have is that getting any change made to the server access will be pretty much impossible and any solution that involves too much messing around to get the results onto a normal Windows networked structure will defeat the purpose of what I'm trying to achieve. &amp;nbsp;I'll contact my Admin and see what they suggest, but it's unlikely to be a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;At the moment I would export one file as a step in the process, to a Windows network folder away from the SAS environment, then use an Excel VBA code to split it. &amp;nbsp;I want SAS to do this bit for me so that one click will update all of the resulting datasets. &amp;nbsp;The results are used as dataconnections for various user tools that we develop, but we develop and don't want to be spending resource updating data where it can be done automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess what I'm after is the code behind the 'Export {table} as a Step in Project wizard in in EG, but I've not been able to get to that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run the code, then manualy add the Export step that would still save time, but then re-running the code as the data updates will remove the Export steps wouldn't it? &amp;nbsp; Is it possible to add the Export Step to each table as it's created by using code perhaps?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 08:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372055#M275914</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-30T08:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372059#M275915</link>
      <description>&lt;P&gt;When you are after automating the process, your ultimate goal should be a program that can be run in batch mode and that does as much as you can out of the code. Batch programs can easily be automated from the cron daemon or from any scheduling software.&lt;/P&gt;
&lt;P&gt;So if you need to have files moved somewhere, consider using sftp from the server to the target location. Any useful server should have a SSH server process running.&lt;/P&gt;
&lt;P&gt;Try creating filerefs with filename sftp (or ftp, if security is not important and a ftp server is available) for the csv files, and write the export to that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 08:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372059#M275915</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-30T08:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a Table by Column Contents?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372062#M275916</link>
      <description>&lt;P&gt;Thanks, I'm pretty sure I won't have access to any of those things, our environment is heavily controlled. &amp;nbsp;I'll contact my Admin and see what they suggest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paul.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 08:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Splitting-a-Table-by-Column-Contents/m-p/372062#M275916</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2017-06-30T08:58:29Z</dc:date>
    </item>
  </channel>
</rss>

