<?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: Create variables in longitudinal data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504177#M134885</link>
    <description>Show an example of your data please. &lt;BR /&gt;Instructions on how to do so are here. I would probably recommend a custom format. &lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/tac-p/436960#M2686" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/tac-p/436960#M2686&lt;/A&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 15 Oct 2018 03:08:19 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-10-15T03:08:19Z</dc:date>
    <item>
      <title>Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504172#M134884</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have longitudinal data (1 obs per person per minute) with two time variables: date and time. I would like to create summary variables between 7pm on one day and 12 pm on the next day. How can I create this time interval using these two variables???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 02:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504172#M134884</guid>
      <dc:creator>lalaktgrau</dc:creator>
      <dc:date>2018-10-15T02:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504177#M134885</link>
      <description>Show an example of your data please. &lt;BR /&gt;Instructions on how to do so are here. I would probably recommend a custom format. &lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/tac-p/436960#M2686" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/tac-p/436960#M2686&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Oct 2018 03:08:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504177#M134885</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-15T03:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504178#M134886</link>
      <description>&lt;P&gt;I combined date and time into one variable. I'd still only like to count people between certain time intervals.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data WORK.CLASS;&lt;BR /&gt;infile datalines truncover;&lt;BR /&gt;input Name:$8. sleep&amp;nbsp;datetime;&lt;BR /&gt;informat datetime datetime20.;&lt;BR /&gt;format datetime datetime20.;&lt;BR /&gt;datalines;&lt;BR /&gt;Alfred 0 04MAR14:23:55:00&lt;BR /&gt;Alfred 0 04MAR14:23:56:00&lt;BR /&gt;Alfred 1 04MAR14:23:57:00&lt;BR /&gt;Alfred 1 04MAR14:23:58:00&lt;BR /&gt;Alfred 1 04MAR14:23:59:00&lt;BR /&gt;Alfred 1 04MAR14:00:00:00&lt;BR /&gt;Alfred 1 04MAR14:01:01:00&lt;BR /&gt;Alfred 1 04MAR14:01:02:00&lt;BR /&gt;Alfred 1 04MAR14:01:03:00&lt;BR /&gt;Alfred 1 04MAR14:01:04:00&lt;/P&gt;&lt;P&gt;mary 0 04MAR14:23:55:00&lt;BR /&gt;mary 0 04MAR14:23:56:00&lt;BR /&gt;mary 1 04MAR14:23:57:00&lt;BR /&gt;mary 1 04MAR14:23:58:00&lt;BR /&gt;mary 1 04MAR14:23:59:00&lt;BR /&gt;mary 1 04MAR14:00:00:00&lt;BR /&gt;mary 1 04MAR14:01:01:00&lt;BR /&gt;mary 1 04MAR14:01:02:00&lt;BR /&gt;mary 1 04MAR14:01:03:00&lt;BR /&gt;mary 1 04MAR14:01:04:00&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 03:23:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504178#M134886</guid>
      <dc:creator>lalaktgrau</dc:creator>
      <dc:date>2018-10-15T03:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504179#M134887</link>
      <description>Are your date intervals all over the place or do they have an upper and lower limit?&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Oct 2018 03:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504179#M134887</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-15T03:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504180#M134888</link>
      <description>&lt;P&gt;I have one week per person, every single minute!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 03:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504180#M134888</guid>
      <dc:creator>lalaktgrau</dc:creator>
      <dc:date>2018-10-15T03:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504181#M134889</link>
      <description>&lt;P&gt;I understand that,&amp;nbsp;but is there a starting date and end date that you know, ie the data is all between 2014 and 2018?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/161934"&gt;@lalaktgrau&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have one week per person, every single minute!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 03:34:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504181#M134889</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-15T03:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504184#M134890</link>
      <description>&lt;P&gt;No! It's all over the place. Different people had different starts and ends. I just want to pull all the nighttime data, so I think we can disregard the dates (except to know start of night one day, morning the next day 7pm-12pm).&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 03:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504184#M134890</guid>
      <dc:creator>lalaktgrau</dc:creator>
      <dc:date>2018-10-15T03:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504187#M134891</link>
      <description>You can't disregard the dates, since you need to account for the time, unless you're absolutely positive you have a record for every single minute.  In that case you could just do a simple IF/THEN comparison. But from the first to last date you would have no breaks.</description>
      <pubDate>Mon, 15 Oct 2018 03:47:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504187#M134891</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-15T03:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504188#M134892</link>
      <description>I can't test with your sample data because there's no day, it's all night.</description>
      <pubDate>Mon, 15 Oct 2018 03:54:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504188#M134892</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-15T03:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504189#M134893</link>
      <description>&lt;P&gt;Hello, can you&amp;nbsp;explicitly specify your output ? if possible.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;what is meaning for 0 and 1 ?&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;is it yes or no ?&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 15 Oct 2018 03:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504189#M134893</guid>
      <dc:creator>shahparth260</dc:creator>
      <dc:date>2018-10-15T03:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create variables in longitudinal data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504190#M134894</link>
      <description>&lt;P&gt;On second thought, not sure it matters either. Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;

if hour(timepart(datetime)) &amp;gt;= 19 or hour(timepart(datetime)) &amp;lt;= 12 then interval='Night';
else interval = 'Day';

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Oct 2018 03:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-variables-in-longitudinal-data/m-p/504190#M134894</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-15T03:59:34Z</dc:date>
    </item>
  </channel>
</rss>

