<?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: Combining two variables-data collected under two different variable names actually belongs to on in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532406#M16458</link>
    <description>&lt;P&gt;The&amp;nbsp;COALESCE function worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to combine two variables in to one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 03 Feb 2019 15:36:46 GMT</pubDate>
    <dc:creator>kk11</dc:creator>
    <dc:date>2019-02-03T15:36:46Z</dc:date>
    <item>
      <title>Combining two variables-data collected under two different variable names actually belongs to one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532397#M16452</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two variables named&amp;nbsp;CCR_NIS and&amp;nbsp;APICC. There are missing observations in these two variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually these are not missing data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data for year 2015 was collected under the variable named CCR_NIS and the similar data for year 2011 was collected under the variable named APICC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually all the data should be in one variable, as the data under these&amp;nbsp;two&amp;nbsp;variables&amp;nbsp;named CCR_NIS and&amp;nbsp;APICC is same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to move the data from APICC in to&amp;nbsp;CCR_NIS for corresponding observations where it is empty in CCR_NIS, so that all my data is under&amp;nbsp;CCR_NIS and finally I can delete the variable&amp;nbsp;APICC.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My final data set will have&amp;nbsp;CCR_NIS only without any&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find the data below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had hard time in figuring out the code to perform this task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me in writing the code for this Task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CCR_NIS&lt;/TD&gt;&lt;TD&gt;APICC&lt;/TD&gt;&lt;TD&gt;YEAR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.274&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2015&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.274&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2015&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.399&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;2015&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.414&lt;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/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 03 Feb 2019 14:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532397#M16452</guid>
      <dc:creator>kk11</dc:creator>
      <dc:date>2019-02-03T14:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two variables-data collected under two different variable names actually belongs to on</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532399#M16453</link>
      <description>&lt;P&gt;as long as the data variables are the same type why not use rename&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc freq data=sashelp.class( rename=(sex=gender));&lt;BR /&gt;tables gender;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: #eaeaea; color: #333333; font-family: monospace,monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; word-wrap: normal;"&gt;( rename=(APICC = CCR_NIS))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Feb 2019 14:43:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532399#M16453</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-02-03T14:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two variables-data collected under two different variable names actually belongs to on</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532401#M16454</link>
      <description>&lt;DIV class="sasSource"&gt;I got the following error.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;62 Proc freq data=Sample.Sample_CLEAN2( rename=(APICC = CCR_NIS));&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Variable CCR_NIS already exists on file Sample.Sample_CLEAN2.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Invalid DROP, KEEP, or RENAME option on file Sample.Sample_CLEAN2.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;63 tables CCR_NIS;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: No data set open to look up variables.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;64 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE FREQ used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;65&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;66 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79&lt;/DIV&gt;</description>
      <pubDate>Sun, 03 Feb 2019 14:58:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532401#M16454</guid>
      <dc:creator>kk11</dc:creator>
      <dc:date>2019-02-03T14:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two variables-data collected under two different variable names actually belongs to on</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532402#M16455</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/245416"&gt;@kk11&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why don't you use the &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p1vjttz6nuankzn1gh4z3wgcu0bf.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;COALESCE function&lt;/A&gt;?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input CCR_NIS APICC year;
cards;
0.298 .        2015
.     0.263067 2011
;

data want(drop=apicc);
set have;
ccr_nis=coalesce(ccr_nis, apicc);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 03 Feb 2019 14:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532402#M16455</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-02-03T14:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two variables-data collected under two different variable names actually belongs to on</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532403#M16456</link>
      <description>&lt;P&gt;I just don't want to rename the APICC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to move the data in APICC variable to empty observations in CCR_NIS variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So that there wont be any data in APICC and all the data will be in CCR_NIS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally I can delete the&amp;nbsp;APICC variable from the dataset.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Feb 2019 15:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532403#M16456</guid>
      <dc:creator>kk11</dc:creator>
      <dc:date>2019-02-03T15:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two variables-data collected under two different variable names actually belongs to on</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532404#M16457</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input CCR_NIS :8. APICC :8.  YEAR :$4.;
datalines;
0.274 . 2015
0.274 . 2015
0.399 . 2015
0.414 . 2015
0.298 . 2015
0.315 . 2015
0.315 . 2015
0.299 . 2015
0.29 . 2015
0.298 . 2015
0.298 . 2015
. 0.263067 2011
. 0.263067 2011
. 0.263067 2011
. 0.253981 2011
. 0.253981 2011
. 0.253981 2011
. 0.253981 2011
. 0.215371 2011
. 0.215371 2011
. 0.215371 2011
. 0.215371 2011
. 0.215371 2011
. 0.215371 2011
;
data want;
	set have;
	if CCR_NIS = . then CCR_NIS = APICC;
	drop APICC;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 03 Feb 2019 15:23:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532404#M16457</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-02-03T15:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two variables-data collected under two different variable names actually belongs to on</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532406#M16458</link>
      <description>&lt;P&gt;The&amp;nbsp;COALESCE function worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to combine two variables in to one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Feb 2019 15:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532406#M16458</guid>
      <dc:creator>kk11</dc:creator>
      <dc:date>2019-02-03T15:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Combining two variables-data collected under two different variable names actually belongs to on</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532407#M16459</link>
      <description>&lt;P&gt;your code worked too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked it after COALESCE function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Feb 2019 15:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Combining-two-variables-data-collected-under-two-different/m-p/532407#M16459</guid>
      <dc:creator>kk11</dc:creator>
      <dc:date>2019-02-03T15:40:24Z</dc:date>
    </item>
  </channel>
</rss>

