<?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: Data from five data steps with a numeric variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-from-five-data-steps-with-a-numeric-variable/m-p/74937#M16146</link>
    <description>I just saw data_null_ beat me to it.  Anyway . . .&lt;BR /&gt;
&lt;BR /&gt;
This is an example of how I would do it, but it takes a couple steps.  In this example, I create three datasets with different variable formats.  After merging these sets, I determine the numeric variables using PROC CONTENTS and PROC SQL and then limit my final dataset to just those variables.&lt;BR /&gt;
&lt;BR /&gt;
[pre]data a (keep=VarA:) b (keep=VarB:) c (keep=VarC:);&lt;BR /&gt;
	VarA1 = 8; VarA2 = 'Yes'; output a;&lt;BR /&gt;
	VarB1 = 'True'; VarB2 = 256; output b;&lt;BR /&gt;
	VarC1 = 'Positive'; VarC2 = 'Nebraska'; VarC3 = 87.9; output c;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data x;&lt;BR /&gt;
	merge a b c;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc contents data=x out=contents (keep=name type) noprint;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
	select name into :varlst separated by ' ' from contents where type = 1;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
data x;&lt;BR /&gt;
	set x;&lt;BR /&gt;
	keep &amp;amp;varlst;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]

Message was edited by: 1162</description>
    <pubDate>Fri, 20 Feb 2009 18:50:49 GMT</pubDate>
    <dc:creator>1162</dc:creator>
    <dc:date>2009-02-20T18:50:49Z</dc:date>
    <item>
      <title>Data from five data steps with a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-from-five-data-steps-with-a-numeric-variable/m-p/74935#M16144</link>
      <description>I am having a library, in that there are five datasets with five variables each and having only one observation.Out of five variables one variable is numeric.&lt;BR /&gt;
I want the data from all five datasets with a numeric variable.&lt;BR /&gt;
How can I do this using datastep or a macro without knowing whether a variable is numeric?&lt;BR /&gt;
Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Sidhu</description>
      <pubDate>Fri, 20 Feb 2009 16:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-from-five-data-steps-with-a-numeric-variable/m-p/74935#M16144</guid>
      <dc:creator>Siddhartha</dc:creator>
      <dc:date>2009-02-20T16:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Data from five data steps with a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-from-five-data-steps-with-a-numeric-variable/m-p/74936#M16145</link>
      <description>I don't understand what you want.  I will guess.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
* Example data;&lt;BR /&gt;
data a1 a3 a4;&lt;BR /&gt;
   retain c1-c4 'Y' n1 1;&lt;BR /&gt;
   run;&lt;BR /&gt;
data a2 a5;&lt;BR /&gt;
   retain d1-d4 'D' a 2;&lt;BR /&gt;
   run;&lt;BR /&gt;
* Concatenate numeric variables;&lt;BR /&gt;
data a;&lt;BR /&gt;
   set &lt;BR /&gt;
      a1(keep=_numeric_)&lt;BR /&gt;
      a2(keep=_numeric_)      &lt;BR /&gt;
      a3(keep=_numeric_)      &lt;BR /&gt;
      a4(keep=_numeric_)      &lt;BR /&gt;
      a5(keep=_numeric_)&lt;BR /&gt;
      ;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 20 Feb 2009 18:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-from-five-data-steps-with-a-numeric-variable/m-p/74936#M16145</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-02-20T18:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Data from five data steps with a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-from-five-data-steps-with-a-numeric-variable/m-p/74937#M16146</link>
      <description>I just saw data_null_ beat me to it.  Anyway . . .&lt;BR /&gt;
&lt;BR /&gt;
This is an example of how I would do it, but it takes a couple steps.  In this example, I create three datasets with different variable formats.  After merging these sets, I determine the numeric variables using PROC CONTENTS and PROC SQL and then limit my final dataset to just those variables.&lt;BR /&gt;
&lt;BR /&gt;
[pre]data a (keep=VarA:) b (keep=VarB:) c (keep=VarC:);&lt;BR /&gt;
	VarA1 = 8; VarA2 = 'Yes'; output a;&lt;BR /&gt;
	VarB1 = 'True'; VarB2 = 256; output b;&lt;BR /&gt;
	VarC1 = 'Positive'; VarC2 = 'Nebraska'; VarC3 = 87.9; output c;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data x;&lt;BR /&gt;
	merge a b c;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc contents data=x out=contents (keep=name type) noprint;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
	select name into :varlst separated by ' ' from contents where type = 1;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
data x;&lt;BR /&gt;
	set x;&lt;BR /&gt;
	keep &amp;amp;varlst;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]

Message was edited by: 1162</description>
      <pubDate>Fri, 20 Feb 2009 18:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-from-five-data-steps-with-a-numeric-variable/m-p/74937#M16146</guid>
      <dc:creator>1162</dc:creator>
      <dc:date>2009-02-20T18:50:49Z</dc:date>
    </item>
  </channel>
</rss>

