<?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: HOw can I create 25 datasets in data step in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16865#M3145</link>
    <description>You could also use a hash solution.  Here is an example with sashelp.class.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
	if _n_=1 then do;&lt;BR /&gt;
		declare hash h();&lt;BR /&gt;
		h.definekey('_n_');&lt;BR /&gt;
		h.definedata("Name", "Sex", "Age");&lt;BR /&gt;
		h.definedone();&lt;BR /&gt;
	end;&lt;BR /&gt;
	set sashelp.class;&lt;BR /&gt;
	h.clear();&lt;BR /&gt;
	h.add();&lt;BR /&gt;
	num = 'Obs'!!trim(left(put(_n_, 8.)));&lt;BR /&gt;
	h.output(dataset:num);&lt;BR /&gt;
run;&lt;BR /&gt;
	&lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 24 Feb 2011 20:59:02 GMT</pubDate>
    <dc:creator>polingjw</dc:creator>
    <dc:date>2011-02-24T20:59:02Z</dc:date>
    <item>
      <title>HOw can I create 25 datasets in data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16862#M3142</link>
      <description>ORG                       SITE           LOC            ASSET           amount&lt;BR /&gt;
===================================================&lt;BR /&gt;
QUANTUM	MCA	MCA01	TRAN	TRAN_HTT	310.00&lt;BR /&gt;
QUANTUM	MCA	MCA01	TRAN	TRAN_HTT	261.50&lt;BR /&gt;
QUANTUM	MCA	MCA01	TRAN	TRAN_HTT	273.80&lt;BR /&gt;
QUANTUM	MCA	MCA01	TRAN	TRAN_HTT	329.30&lt;BR /&gt;
QUANTUM	MCA	MCA01	TRAN	TRAN_HTT	290.80&lt;BR /&gt;
QUANTUM	MCA	MCA01	TRAN	TRAN_HTT	324.20&lt;BR /&gt;
QUANTUM	MCA	MCA01	TRAN	TRAN_HTT	346.30&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	322.30&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	320.30&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	230.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	367.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	245.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	225.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	398.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	401.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	378.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	265.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	279.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	376.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	345.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	256.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	200.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	278.00&lt;BR /&gt;
IESI	ATX	ATX01	CNC_MIL_400	MIL_LIN_360	345.00&lt;BR /&gt;
===============================================&lt;BR /&gt;
&lt;BR /&gt;
i m having 25 obs i want to copy each obs in a new dataset.&lt;BR /&gt;
&lt;BR /&gt;
Which means 25 obs should be split into 25 dataset . Each dataset consisting on 1 obs .&lt;BR /&gt;
&lt;BR /&gt;
i can do in simple way like:&lt;BR /&gt;
data one two three -------- twnyfive;&lt;BR /&gt;
set datsetname;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
but my issue is that if there are 500 obs if i want 2 copy the values in 500 diffrent dataset i can write all 500 dataset name.&lt;BR /&gt;
&lt;BR /&gt;
thnxzzzzz in advnce &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 24 Feb 2011 14:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16862#M3142</guid>
      <dc:creator>sss</dc:creator>
      <dc:date>2011-02-24T14:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: HOw can I create 25 datasets in data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16863#M3143</link>
      <description>You could write a macro to do this:&lt;BR /&gt;
First, get the number of obs into a macro var using a null data step or Proc SQL.&lt;BR /&gt;
Then you could write a data step something like this:&lt;BR /&gt;
&lt;BR /&gt;
data %do i=1 %to &amp;amp;N_obs;  NewData&amp;amp;i %end;;&lt;BR /&gt;
	set OldData;&lt;BR /&gt;
	%do i=1 %to &amp;amp;N_obs;  &lt;BR /&gt;
		if _N_=&amp;amp;i then output NewData&amp;amp;i; &lt;BR /&gt;
	%end;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 24 Feb 2011 17:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16863#M3143</guid>
      <dc:creator>MaxW</dc:creator>
      <dc:date>2011-02-24T17:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: HOw can I create 25 datasets in data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16864#M3144</link>
      <description>Here's a macro solution, but I do wonder why you want to do this. &lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
select count(*)  into :num_records from sashelp.class ;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
%put &amp;amp;num_records;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro output_separate();&lt;BR /&gt;
&lt;BR /&gt;
	%do i=1 %to &amp;amp;num_records;&lt;BR /&gt;
	data data_&amp;amp;i;&lt;BR /&gt;
		format obsnum 8.;&lt;BR /&gt;
		obsnum=&amp;amp;i.;&lt;BR /&gt;
		set sashelp.class point=obsnum;&lt;BR /&gt;
		output;&lt;BR /&gt;
		stop;&lt;BR /&gt;
	run;&lt;BR /&gt;
	%end;&lt;BR /&gt;
%mend;	&lt;BR /&gt;
&lt;BR /&gt;
%output_separate</description>
      <pubDate>Thu, 24 Feb 2011 17:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16864#M3144</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2011-02-24T17:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: HOw can I create 25 datasets in data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16865#M3145</link>
      <description>You could also use a hash solution.  Here is an example with sashelp.class.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
	if _n_=1 then do;&lt;BR /&gt;
		declare hash h();&lt;BR /&gt;
		h.definekey('_n_');&lt;BR /&gt;
		h.definedata("Name", "Sex", "Age");&lt;BR /&gt;
		h.definedone();&lt;BR /&gt;
	end;&lt;BR /&gt;
	set sashelp.class;&lt;BR /&gt;
	h.clear();&lt;BR /&gt;
	h.add();&lt;BR /&gt;
	num = 'Obs'!!trim(left(put(_n_, 8.)));&lt;BR /&gt;
	h.output(dataset:num);&lt;BR /&gt;
run;&lt;BR /&gt;
	&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 24 Feb 2011 20:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16865#M3145</guid>
      <dc:creator>polingjw</dc:creator>
      <dc:date>2011-02-24T20:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: HOw can I create 25 datasets in data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16866#M3146</link>
      <description>HI Reeza &lt;BR /&gt;
&lt;BR /&gt;
thnxs a lot its working f9</description>
      <pubDate>Fri, 25 Feb 2011 09:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16866#M3146</guid>
      <dc:creator>sss</dc:creator>
      <dc:date>2011-02-25T09:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: HOw can I create 25 datasets in data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16867#M3147</link>
      <description>hi polingjw 	&lt;BR /&gt;
&lt;BR /&gt;
Code is working gr8 thnx uuu</description>
      <pubDate>Fri, 25 Feb 2011 09:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16867#M3147</guid>
      <dc:creator>sss</dc:creator>
      <dc:date>2011-02-25T09:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: HOw can I create 25 datasets in data step</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16868#M3148</link>
      <description>Hello SSS,&lt;BR /&gt;
&lt;BR /&gt;
This is a pure datastep solution:&lt;BR /&gt;
&lt;BR /&gt;
[pre]data d1 d2 d3 d4;&lt;BR /&gt;
  set datsetname;&lt;BR /&gt;
  if      _n_=1 then output d1;&lt;BR /&gt;
  else if _n_=2 then output d2;&lt;BR /&gt;
  else if _n_=3 then output d3;&lt;BR /&gt;
  else if _n_=4 then output d4;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Wed, 02 Mar 2011 21:28:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/HOw-can-I-create-25-datasets-in-data-step/m-p/16868#M3148</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-03-02T21:28:15Z</dc:date>
    </item>
  </channel>
</rss>

