<?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 a flag that identifies whether members are eligible for the refund. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Create-a-flag-that-identifies-whether-members-are-eligible-for/m-p/739492#M28959</link>
    <description>&lt;P&gt;Please attach the data file to your post, so we can run your import code and have the dataset for testing.&lt;/P&gt;
&lt;P&gt;In case the communities website rejects the .dat extension, change it to .csv.&lt;/P&gt;</description>
    <pubDate>Thu, 06 May 2021 14:06:33 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-05-06T14:06:33Z</dc:date>
    <item>
      <title>Create a flag that identifies whether members are eligible for the refund.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-flag-that-identifies-whether-members-are-eligible-for/m-p/739472#M28958</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to solve the following exercise, but I haven't got a clue how to solve letter c.&lt;/P&gt;&lt;P&gt;Can someone help me out?&amp;nbsp;&lt;/P&gt;&lt;P&gt;34. A local gym runs a New Year’s membership offer that is available to anyone who joins the gym on&lt;BR /&gt;January 1st. The promotion states that if the new member continues to work out for at least 30&lt;BR /&gt;minutes a day for the first four months of the year, then they will have the $150 start-up fee&lt;BR /&gt;refunded. This year, 245 people signed up for the offer. Members were tracked automatically via&lt;BR /&gt;the computer check-in system when they arrived and left the gym. The raw data file NewYears.dat&lt;BR /&gt;contains variables for the member ID, and check-in times for the first 119 days of the year,&lt;BR /&gt;followed by the check-out times for the first 119 days of the year.&lt;BR /&gt;a. Examine the raw data file NewYears.dat and read it into SAS.&lt;BR /&gt;b. Create new variables for the time (in minutes) that the member spent at the gym each day.&lt;BR /&gt;c. Create a flag that identifies whether members are eligible for the refund. Members are eligible if&lt;BR /&gt;they worked out for at least 30 minutes a day for all 119 days.&lt;BR /&gt;d. Calculate the overall average time spent at the gym for each new member.&lt;BR /&gt;e. View the resulting data set. In a comment in your program, state the values for refund eligibility&lt;BR /&gt;and overall average time for members 330 and 331.*/&lt;BR /&gt;proc import&lt;BR /&gt;datafile="/folders/myfolders/The Little SAS Book/Input/Chapter 3/NewYears.dat"&lt;BR /&gt;out=newy replace dbms=dlm;&lt;BR /&gt;delimiter=",";&lt;BR /&gt;getnames=yes;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data newy;&lt;BR /&gt;set newy;&lt;BR /&gt;array in {119} In_Day_1-In_Day_119;&lt;BR /&gt;array out {119} Out_Day_1-Out_Day_119;&lt;BR /&gt;array timesession {119};&lt;/P&gt;&lt;P&gt;do i=1 to 119;&lt;BR /&gt;timesession{i}=out{i} - in{i};&lt;BR /&gt;end;&lt;BR /&gt;AvgTime=mean(of timesession1-timesession119);&lt;BR /&gt;informat In_Day_1-In_Day_119 Out_Day_1-Out_Day_119 AvgTime&lt;BR /&gt;timesession1-timesession119 time5.;&lt;BR /&gt;format In_Day_1-In_Day_119 Out_Day_1-Out_Day_119 AvgTime&lt;BR /&gt;timesession1-timesession119 time5.;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 13:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-flag-that-identifies-whether-members-are-eligible-for/m-p/739472#M28958</guid>
      <dc:creator>OGA13</dc:creator>
      <dc:date>2021-05-06T13:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create a flag that identifies whether members are eligible for the refund.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-flag-that-identifies-whether-members-are-eligible-for/m-p/739492#M28959</link>
      <description>&lt;P&gt;Please attach the data file to your post, so we can run your import code and have the dataset for testing.&lt;/P&gt;
&lt;P&gt;In case the communities website rejects the .dat extension, change it to .csv.&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 14:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-flag-that-identifies-whether-members-are-eligible-for/m-p/739492#M28959</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-05-06T14:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create a flag that identifies whether members are eligible for the refund.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-flag-that-identifies-whether-members-are-eligible-for/m-p/739504#M28960</link>
      <description>&lt;P&gt;c. Create a flag that identifies whether members are eligible for the refund. Members are eligible if&lt;BR /&gt;they worked out for at least 30 minutes a day for all 119 days.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would be if the MINIMUM value for ALL of the variables is 30 minutes or more AND all of the values are not missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which would look a lot like your AvgTime but with the MIN function instead of MEAN and "ge 30" if the values in the Timesession variables are minutes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Flag = (min(of timesession1-timesession119) ge 30 AND nmiss(of timesession1-timesession119)=0 );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The missing needs to be considered because the MIN function will ignore missing values for returning the minimum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS will return 1 for true and 0 for false for&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 15:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-flag-that-identifies-whether-members-are-eligible-for/m-p/739504#M28960</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-06T15:01:55Z</dc:date>
    </item>
  </channel>
</rss>

