<?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: Concatenating 4 datasets with same data, different variable names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-4-datasets-with-same-data-different-variable-names/m-p/679880#M205351</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/335379"&gt;@sasfreaky&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;It's not clear to me what you want to achieve, a simple example would be helpful.&lt;BR /&gt;Having said that here's an example that might be similar to what you are trying to achieve&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table_1 ;
	input 
		cicact2  $
		csucputm ;
cards ;
AAAA 5
BBBB 6
CCCC 3
DDDD 4
;

data table_2;
	input 
		imsact2 $
		isucputm ;
cards ;
AAAA 5
BBBB 6
CCCC 3
DDDD 4
;

/* Combine the tables */
data both ;	
	set table_1 table_2 (rename=(imsact2=cicact2 isucputm=csucputm)) ;
run ;

/* Create summary output */
/* https://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p0aq3hsvflztfzn1xa2wt6s35oy6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en */
proc summary data=both ;
	output out=summary sum=sumvar ;
	class cicact2 ;
	var csucputm ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 Aug 2020 19:18:01 GMT</pubDate>
    <dc:creator>AMSAS</dc:creator>
    <dc:date>2020-08-27T19:18:01Z</dc:date>
    <item>
      <title>Concatenating 4 datasets with same data, different variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-4-datasets-with-same-data-different-variable-names/m-p/679851#M205336</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS, and am not a coder by trade but can get by with small things. My platform is the Mainframe.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My situation is I have 4 datasets, each of these datasets collect the same 2 variable but each dataset variable has a slightly name different.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variable 1: These are the 4 variable names that contain a 4 character BUCS code. In each dataset, the BUCS code will have multiple instances so I have to summarize into 1 and add the total seconds with associated variable to, CPU time.&lt;/P&gt;&lt;P&gt;CICACT2 / IMSACT2&amp;nbsp;/ DB2IACT3 / ACCTNO2 = BUCS&amp;nbsp; $char4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variable 2: These are the 4 variable names that contain the CPU TIME in seconds. The&lt;/P&gt;&lt;P&gt;CSUCPUTM / ISUCPUTM / DSUCPUTM / PGMCPUTM = CPU time (seconds)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems like a fairly easy task for a seasoned programmer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was looking at MEAN/SUMMARY , TYPE, and the CONCATENATION part of the DOCS but didnt find what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 18:00:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-4-datasets-with-same-data-different-variable-names/m-p/679851#M205336</guid>
      <dc:creator>sasfreaky</dc:creator>
      <dc:date>2020-08-27T18:00:08Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating 4 datasets with same data, different variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-4-datasets-with-same-data-different-variable-names/m-p/679877#M205348</link>
      <description>&lt;P&gt;You can combine data sets and rename them all to the same name in a data step.&lt;/P&gt;
&lt;P&gt;Suppose I have some data sets with the same "variable" but slightly different name in several sets, such as ABC1 ABC2 and ABC3 (actual names aren't important but just to tell them apart) and that I would like to just have the name ABC for consistency:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set 
      have1 (rename=(ABC1 = ABC))
      have2 (rename=(ABC2 = ABC))
      have3 (rename=(ABC3 = ABC))
   ;
run;
&lt;/PRE&gt;
&lt;P&gt;So each record in the result would have values for ABC from the sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note the RENAME done this way is done in pairs of Oldname=newname. You could rename multiple variables such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;have1 (rename=(ABC1 = ABC&amp;nbsp; thisname=thatname rate=newrate))&lt;/P&gt;
&lt;P&gt;or what have you.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 19:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-4-datasets-with-same-data-different-variable-names/m-p/679877#M205348</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-27T19:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenating 4 datasets with same data, different variable names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenating-4-datasets-with-same-data-different-variable-names/m-p/679880#M205351</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/335379"&gt;@sasfreaky&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;It's not clear to me what you want to achieve, a simple example would be helpful.&lt;BR /&gt;Having said that here's an example that might be similar to what you are trying to achieve&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table_1 ;
	input 
		cicact2  $
		csucputm ;
cards ;
AAAA 5
BBBB 6
CCCC 3
DDDD 4
;

data table_2;
	input 
		imsact2 $
		isucputm ;
cards ;
AAAA 5
BBBB 6
CCCC 3
DDDD 4
;

/* Combine the tables */
data both ;	
	set table_1 table_2 (rename=(imsact2=cicact2 isucputm=csucputm)) ;
run ;

/* Create summary output */
/* https://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p0aq3hsvflztfzn1xa2wt6s35oy6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en */
proc summary data=both ;
	output out=summary sum=sumvar ;
	class cicact2 ;
	var csucputm ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Aug 2020 19:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenating-4-datasets-with-same-data-different-variable-names/m-p/679880#M205351</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2020-08-27T19:18:01Z</dc:date>
    </item>
  </channel>
</rss>

