<?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: un-merging a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861262#M340212</link>
    <description>No. Don't have the code or original datasets. I'm prepared to assume that any variable that is constant within personid comes from the person file. (Even if not, the fact that it is constant within person is useful enough).</description>
    <pubDate>Tue, 28 Feb 2023 02:00:13 GMT</pubDate>
    <dc:creator>BruceBrad</dc:creator>
    <dc:date>2023-02-28T02:00:13Z</dc:date>
    <item>
      <title>un-merging a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861258#M340210</link>
      <description>&lt;P&gt;I'm trying to un-merge a dataset. More specifically, I have a dataset with variables:&lt;/P&gt;
&lt;P&gt;PersonID&lt;/P&gt;
&lt;P&gt;EventID (there can be multiple events per person)&lt;/P&gt;
&lt;P&gt;a number of person-level variables that are constant within personID&lt;/P&gt;
&lt;P&gt;a number of event-level variables that can vary within personID&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to end up with a person-level file, with one record per personID, including all the person-level variables. I could do this manually by just selecting on first.personID and keeping the person-level variables. But there are a large number of variables, and it is not obvious which are person and which are event level. Is there an easy way to identify which variables are fixed within personID, and keep only these in the output file. (They are a mix of numeric and character).&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 01:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861258#M340210</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2023-02-28T01:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: un-merging a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861261#M340211</link>
      <description>&lt;P&gt;Do you have the code which merged them in the first place? What if there were variables common to both? If you don't have the original merge code then intelligent guesswork is pretty much your only option.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 01:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861261#M340211</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-02-28T01:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: un-merging a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861262#M340212</link>
      <description>No. Don't have the code or original datasets. I'm prepared to assume that any variable that is constant within personid comes from the person file. (Even if not, the fact that it is constant within person is useful enough).</description>
      <pubDate>Tue, 28 Feb 2023 02:00:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861262#M340212</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2023-02-28T02:00:13Z</dc:date>
    </item>
    <item>
      <title>Re: un-merging a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861263#M340213</link>
      <description>&lt;P&gt;In that case I would go with that assumption to split the data. Something like this might help:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data person;
  set PersonEvent;
  by PersonID;
  if first.PersonID;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Feb 2023 02:22:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861263#M340213</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-02-28T02:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: un-merging a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861277#M340218</link>
      <description>&lt;P&gt;First pass is to use NLEVELS option on PROC FREQ.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=HAVE nlevels;
tables _all_ / noprint;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could then check in more detail any variable that has the same number of levels as the PERSONID variable.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 04:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861277#M340218</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-02-28T04:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: un-merging a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861278#M340219</link>
      <description>&lt;P&gt;I'll use that for now. Would be nice if there was a way of flagging which variables are constant within personID so I could just keep them - but for now I'll get by with just using the first value of each variable.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 04:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/un-merging-a-dataset/m-p/861278#M340219</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2023-02-28T04:38:32Z</dc:date>
    </item>
  </channel>
</rss>

