<?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: SAS Macro To create multiple dataset from one dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724134#M224817</link>
    <description>&lt;P&gt;Some questions to answer:&lt;/P&gt;
&lt;P&gt;Will there only be one "key" variable such as name or could there multiples that will be used for &lt;STRONG&gt;all&lt;/STRONG&gt; data sets? (not much of a problem but should be considered.)&lt;/P&gt;
&lt;P&gt;Will there only be exactly&amp;nbsp; one "target" variable (height weight sex etc.) or could there be multiples? If multiple how many and how would the name of the data set be created from them (serious issue with name length limit for data sets.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If exactly one key var and only one target var per data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro split (indsn=, outlib=work, keyvar=, targvarlist= );

data 
%do i=1 %to %sysfunc(countw(&amp;amp;targvarlist.) );
   %let targvar = %scan(&amp;amp;targvarlist.,&amp;amp;i.);
   &amp;amp;outlib..&amp;amp;targvar. (keep= &amp;amp;keyvar. &amp;amp;targvar)
%end;
;  /* this ; ends the data statement*/

set &amp;amp;indsn.;
run;
%mend;

%split (indsn=sashelp.class, keyvar=name, targvarlist=age weight height sex)


&lt;/PRE&gt;
&lt;P&gt;Warning: not guaranteed for any variable list involving name literals because of the stupid characters folks come up with. Countw and scan functions very likely could fail.&lt;/P&gt;
&lt;P&gt;Do NOT use a comma delimited list of target variables.&lt;/P&gt;</description>
    <pubDate>Sat, 06 Mar 2021 09:00:31 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-03-06T09:00:31Z</dc:date>
    <item>
      <title>SAS Macro To create multiple dataset from one dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724130#M224813</link>
      <description>&lt;P&gt;hi all,&lt;/P&gt;
&lt;P&gt;i'd love to create multiple datasets&amp;nbsp; from one dataset (sashelp.class) and name each dataset with the target variable(weight height sex age) and the key variable(name).&amp;nbsp; The hard code looks like&amp;nbsp;as follows.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data weight(keep=name weight)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;height(keep=name height)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sex(keep=name sex)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;age(keep=name age);&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Mar 2021 07:55:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724130#M224813</guid>
      <dc:creator>EC189QRW</dc:creator>
      <dc:date>2021-03-06T07:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro To create multiple dataset from one dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724134#M224817</link>
      <description>&lt;P&gt;Some questions to answer:&lt;/P&gt;
&lt;P&gt;Will there only be one "key" variable such as name or could there multiples that will be used for &lt;STRONG&gt;all&lt;/STRONG&gt; data sets? (not much of a problem but should be considered.)&lt;/P&gt;
&lt;P&gt;Will there only be exactly&amp;nbsp; one "target" variable (height weight sex etc.) or could there be multiples? If multiple how many and how would the name of the data set be created from them (serious issue with name length limit for data sets.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If exactly one key var and only one target var per data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro split (indsn=, outlib=work, keyvar=, targvarlist= );

data 
%do i=1 %to %sysfunc(countw(&amp;amp;targvarlist.) );
   %let targvar = %scan(&amp;amp;targvarlist.,&amp;amp;i.);
   &amp;amp;outlib..&amp;amp;targvar. (keep= &amp;amp;keyvar. &amp;amp;targvar)
%end;
;  /* this ; ends the data statement*/

set &amp;amp;indsn.;
run;
%mend;

%split (indsn=sashelp.class, keyvar=name, targvarlist=age weight height sex)


&lt;/PRE&gt;
&lt;P&gt;Warning: not guaranteed for any variable list involving name literals because of the stupid characters folks come up with. Countw and scan functions very likely could fail.&lt;/P&gt;
&lt;P&gt;Do NOT use a comma delimited list of target variables.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Mar 2021 09:00:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724134#M224817</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-06T09:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro To create multiple dataset from one dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724148#M224827</link>
      <description>Yes! the key is unique in customer level and only one  target variable "Good/Bad".  As i've got a really 'wide' widetable which contains almost like 20 thousands features in a dataset. I'd like to caculate the information value (IV) for each feature before Modelling. The size of dataset is enormous and computation resouces is  very limited. Set the widetable for each feature each time is too expensive. So i tried to create multiple dataset in one data step. Accessing the small dataset and do the calculation could save me quite a lot time. Thank you so much for your help, i really appreciate it.</description>
      <pubDate>Sat, 06 Mar 2021 12:43:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724148#M224827</guid>
      <dc:creator>EC189QRW</dc:creator>
      <dc:date>2021-03-06T12:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro To create multiple dataset from one dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724249#M224842</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/60851"&gt;@EC189QRW&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Yes! the key is unique in customer level and only one target variable "Good/Bad". As i've got a really 'wide' widetable which contains almost like 20 thousands features in a dataset. I'd like to caculate the information value (IV) for each feature before Modelling. The size of dataset is enormous and computation resouces is very limited. Set the widetable for each feature each time is too expensive. So i tried to create multiple dataset in one data step. Accessing the small dataset and do the calculation could save me quite a lot time. Thank you so much for your help, i really appreciate it.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It might not hurt to describe what kind of "information value" needs to be calculated for each of these variables and what you attempted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is possible a table that "wide" may have other issues with modeling and possibly belongs in a "long" format.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Mar 2021 06:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724249#M224842</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-07T06:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro To create multiple dataset from one dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724474#M224933</link>
      <description>&lt;P&gt;Splitting the data set may not be necessary, or it may be, but I would first see if the entire data set can be run through the Information Value calculations in the macro here:&amp;nbsp;&lt;A href="https://support.sas.com/resources/papers/proceedings13/095-2013.pdf" target="_blank" rel="noopener"&gt;https://support.sas.com/resources/papers/proceedings13/095-2013.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally, splitting the data is a last resort to be used only when other methods won't work. The other drawback to doing this is that now you have to write a macro to loop through the 1000s of data sets to do the calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case, if you can't run the macro because of resource limitations, you still might be able to run it on 100 variables at a time, or something like that, rather than splitting the data set into a huge number of data sets that are appropriate for analyzing one variable at a time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, there will be other difficulties handling 20000+ variables.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 12:54:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724474#M224933</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-03-08T12:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro To create multiple dataset from one dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724494#M224936</link>
      <description>IV which is designed for screening variables in modeling. I am trying to bulild up a Credit Score Card to predict if a customer default or not in future. The variables come from customers' transaction and their behaviour. if you feel interested, try Naeem Siddiqi's book"Credit Risk Scorecards: Developing and Implementing Intelligent Credit Scoring ", it might help.</description>
      <pubDate>Mon, 08 Mar 2021 13:18:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724494#M224936</guid>
      <dc:creator>EC189QRW</dc:creator>
      <dc:date>2021-03-08T13:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro To create multiple dataset from one dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724495#M224937</link>
      <description>I love this paper. Thanks！</description>
      <pubDate>Mon, 08 Mar 2021 13:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-To-create-multiple-dataset-from-one-dataset/m-p/724495#M224937</guid>
      <dc:creator>EC189QRW</dc:creator>
      <dc:date>2021-03-08T13:19:35Z</dc:date>
    </item>
  </channel>
</rss>

