<?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: Substituting reference values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126762#M25803</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Transpose your data to have one variable but 1000 rows per ID, merge them by ID, variable name, and coalesce the one variable. Then re-transpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or look at the update statement but I'm not sure how that works...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Nov 2012 22:35:01 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2012-11-14T22:35:01Z</dc:date>
    <item>
      <title>Substituting reference values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126761#M25802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have two datasets. Ref contains refrence values, with ID and 1000 variables but just one row.&lt;/P&gt;&lt;P&gt;B dataset contains ID, DOB, and same 1000 variables. Now Some of those 1000 variables in dataset B are populated and some are missing. Wherever those vallues are missing I need to pick the value of that variable from Ref dataset .&lt;/P&gt;&lt;P&gt;Do anyone has a short way of doing it. I dont want to rename 1000 variables in ref dataset and then after merging substitute the value.&lt;/P&gt;&lt;P&gt;I was thinking of using coalesce function in SQL, but that also needs naming all the variables. Any help would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 22:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126761#M25802</guid>
      <dc:creator>maggi2410</dc:creator>
      <dc:date>2012-11-14T22:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Substituting reference values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126762#M25803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Transpose your data to have one variable but 1000 rows per ID, merge them by ID, variable name, and coalesce the one variable. Then re-transpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or look at the update statement but I'm not sure how that works...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 22:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126762#M25803</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-11-14T22:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Substituting reference values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126763#M25804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For the 1,000 variables, are they all numeric or all character, or some mixture of the two?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 22:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126763#M25804</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-14T22:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Substituting reference values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126764#M25805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update is simple enough, and might be the right answer.&amp;nbsp; You can update into a new table, so your original data is still available.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; update B (in = in_B)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ref&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Id ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; in_B ;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Caveat - data has to be sorted by the by variables.&amp;nbsp; Nulls in Ref will not overwrite non null data in B.&amp;nbsp; However, non-null data in Ref will update whatever is in B so if some data in B is more up to date you might need a more complex solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was puzzled by the phrase "but just one row" in your description.&amp;nbsp; Does this mean just one row per ID? if so, does this imply more than one row in B?&amp;nbsp; If so, update is not what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard in Oz.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 23:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126764#M25805</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2012-11-14T23:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Substituting reference values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126765#M25806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Richard: Actually, I was just looking at using the update statement for this in the case where the reference file only contains one record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following was what I was/am proposing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data reference;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input x1-x3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 2 3&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat dob date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input id dob x1-x3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 14nov2012 2 4 6&lt;/P&gt;&lt;P&gt;2 14nov2012 3 . 7&lt;/P&gt;&lt;P&gt;3 14nov2012 . . 8&lt;/P&gt;&lt;P&gt;4 14nov2012 4 6 8&lt;/P&gt;&lt;P&gt;5 14nov2012 . . .&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data expanded_reference;&lt;/P&gt;&lt;P&gt;&amp;nbsp; point=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have (keep=id dob);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set reference point=point;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; update expanded_reference have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2012 23:13:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126765#M25806</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-14T23:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Substituting reference values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126766#M25807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@art: U r awesome. Your solution is just so unique and perfect.Thanku so much. Update is really helpful. I should read more about it.&lt;/P&gt;&lt;P&gt;@richard: Many thanks for introducing update!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 00:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126766#M25807</guid>
      <dc:creator>maggi2410</dc:creator>
      <dc:date>2012-11-15T00:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Substituting reference values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126767#M25808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="5068" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Don't even THINK about posting what I KNOW you are thinking of posting!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 00:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126767#M25808</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-15T00:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Substituting reference values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126768#M25809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art, I ain't saying anything. LOL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 01:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126768#M25809</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-11-15T01:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Substituting reference values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126769#M25810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is one using more "conventional" approach, raw data was stolen from Art's post:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data reference;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input x1-x3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 2 3&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat dob date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input id dob x1-x3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 14nov2012 2 4 6&lt;/P&gt;&lt;P&gt;2 14nov2012 3 . 7&lt;/P&gt;&lt;P&gt;3 14nov2012 . . 8&lt;/P&gt;&lt;P&gt;4 14nov2012 4 6 8&lt;/P&gt;&lt;P&gt;5 14nov2012 . . .&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;if _n_=1 then set reference (rename=x1-x3=_x1-_x3);&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array have x1-x3;&lt;/P&gt;&lt;P&gt;array ref _x1-_x3;&lt;/P&gt;&lt;P&gt;do i=1 to dim(have);&lt;/P&gt;&lt;P&gt;have(i)=coalesce(have(i),ref(i));&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop _: i;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2012 02:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substituting-reference-values/m-p/126769#M25810</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-11-15T02:02:00Z</dc:date>
    </item>
  </channel>
</rss>

