<?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: REg:Output in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/REg-Output/m-p/64799#M18433</link>
    <description>any one can help in this</description>
    <pubDate>Thu, 19 Aug 2010 16:39:21 GMT</pubDate>
    <dc:creator>R_Win</dc:creator>
    <dc:date>2010-08-19T16:39:21Z</dc:date>
    <item>
      <title>REg:Output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/REg-Output/m-p/64797#M18431</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
data all;&lt;BR /&gt;
New_Variable=a,b,c,d,e,f,g,h,i... up ab,ac ...az&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I want them to create new datasets&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
set all;&lt;BR /&gt;
if New_Variable='a' then output;&lt;BR /&gt;
run;&lt;BR /&gt;
...&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
data az;&lt;BR /&gt;
set all;&lt;BR /&gt;
if New_Variable='az' then output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
like this based on this varaible new dataset should be created how can i do this.&lt;BR /&gt;
and in the middle there are different names also in New_Variable 'acz','mnb'&lt;BR /&gt;
and based this new datasets should be created.</description>
      <pubDate>Tue, 17 Aug 2010 13:38:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/REg-Output/m-p/64797#M18431</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2010-08-17T13:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: REg:Output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/REg-Output/m-p/64798#M18432</link>
      <description>You can write a SAS macro that will execute for each SAS variable value.  Suggest you write out your SAS DATA step so it works properly with one value, and then convert that DATA step into a macro where the "value" is substituted with a SAS macro variable  -- the macro variable will be passed to the macro with each execution.  One tip is that when referencing a macro variable as a literal, you enclose it in double-quote marks, not single-quotes.&lt;BR /&gt;
&lt;BR /&gt;
To find all unique (DISTINCT) variable values, you may consider using the PROC SQL DICTIONARY members (or SAS view equivalent) - and with this information you could use macro code to generate macro invocations, once per data value.&lt;BR /&gt;
&lt;BR /&gt;
Some highly recommended reading links provided below to get you started.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic/post:&lt;BR /&gt;
&lt;BR /&gt;
macro programming introduction site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
proc sql dictionary members site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
generate code macro site:sas.com</description>
      <pubDate>Tue, 17 Aug 2010 17:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/REg-Output/m-p/64798#M18432</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-08-17T17:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: REg:Output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/REg-Output/m-p/64799#M18433</link>
      <description>any one can help in this</description>
      <pubDate>Thu, 19 Aug 2010 16:39:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/REg-Output/m-p/64799#M18433</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2010-08-19T16:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: REg:Output</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/REg-Output/m-p/64800#M18434</link>
      <description>Try this code out:&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
	select distinct New_Variable into: all_values separated by ' '&lt;BR /&gt;
	from all;&lt;BR /&gt;
&lt;BR /&gt;
	select count(*) into: num_values from&lt;BR /&gt;
		(select distinct new_variable from all);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
%macro create_datasets;&lt;BR /&gt;
data &amp;amp;all_values;&lt;BR /&gt;
	set all;&lt;BR /&gt;
	%do i = 1 %to &amp;amp;num_values;&lt;BR /&gt;
		%let value = %scan(&amp;amp;all_values, &amp;amp;i);&lt;BR /&gt;
		if New_Variable = "&amp;amp;value" then output &amp;amp;value;&lt;BR /&gt;
	%end;&lt;BR /&gt;
run;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%create_datasets</description>
      <pubDate>Thu, 19 Aug 2010 18:03:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/REg-Output/m-p/64800#M18434</guid>
      <dc:creator>polingjw</dc:creator>
      <dc:date>2010-08-19T18:03:25Z</dc:date>
    </item>
  </channel>
</rss>

