<?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: How to transpose column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422321#M103844</link>
    <description>&lt;P&gt;I think that the following comes close to what you want:&lt;/P&gt;
&lt;PRE&gt;data have;
  informat jobcode $11.;
  input username $ local_date $ local_day $ Clock_IN $ Clock_out $ hours $ jobcode &amp;amp;;
  cards;
aaaaa 12/11/17 Mon 08:56 10:31 1:59 Shift Total
aaaaa 12/11/17 Mon 10:31 10:42 0:17 Rest Break
aaaaa 12/11/17 Mon 10:42 12:54 2:2 Shift Total
aaaaa 12/11/17 Mon 12:54 13:26 0:53 Lunch Break
aaaaa 12/11/17 Mon 13:26 16:09 2:71 Shift Total
aaaaa 12/11/17 Mon 16:09 16:17 0:14 Rest Break
aaaaa 12/11/17 Mon 16:17 17:30 1:22 Shift Total
bbbbb 12/11/17 Mon 08:56 10:31 1:59 Shift Total
bbbbb 12/11/17 Mon 10:31 10:42 0:17 Rest Break
bbbbb 12/11/17 Mon 10:42 12:54 2:2 Shift Total
bbbbb 12/11/17 Mon 12:54 13:26 0:53 Lunch Break
bbbbb 12/11/17 Mon 13:26 16:09 2:71 Shift Total
bbbbb 12/11/17 Mon 16:09 16:17 0:14 Rest Break
bbbbb 12/11/17 Mon 16:17 17:30 1:22 Shift Total
;
run;

data need;
  set have;
  by username local_date;
  format _Shift_Total time5.;
  retain _Shift_Total;
  if first.local_date then do;
    i=1;
    _Shift_Total=input(Clock_IN,time5.);
  end;
  else if jobcode eq 'Shift Total' then i+1;
  if last.username then _Shift_Total=input(Clock_out,time5.)-_Shift_Total;
run;

data need;
  format Shift_Total time5.;
  do until (last.local_date);
    set need;
    by username local_date;
    if last.local_date then Shift_Total=_Shift_Total;
  end;
  do until (last.local_date);
    set need;
    by username local_date;
    output;
  end;
run;

proc transpose data=need out=want (where=(not missing(_NAME_)));
  by username local_date;
  copy Shift_Total;
  var hours;
  id jobcode i;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Dec 2017 15:38:03 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-12-19T15:38:03Z</dc:date>
    <item>
      <title>How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422076#M103776</link>
      <description>&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp; data of record with clock in ad clock out. I want to extract the different shifts from the record.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the sample data&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; have;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; username $ local_date $ local_day $ Clock_IN $ Clock_out $ hours $ jobcode $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;49&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;60&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;aaaaa 12/11/17 Mon 08:56 10:31 1:59 Shift Total&lt;/P&gt;&lt;P&gt;aaaaa 12/11/17 Mon 10:31 10:42 0:17 Rest Break&lt;/P&gt;&lt;P&gt;aaaaa 12/11/17 Mon 10:42 12:54 2:2 Shift Total&lt;/P&gt;&lt;P&gt;aaaaa 12/11/17 Mon 12:54 13:26 0:53 Lunch Break&lt;/P&gt;&lt;P&gt;aaaaa 12/11/17 Mon 13:26 16:09 2:71 Shift Total&lt;/P&gt;&lt;P&gt;aaaaa 12/11/17 Mon 16:09 16:17 0:14 Rest Break&lt;/P&gt;&lt;P&gt;aaaaa 12/11/17 Mon 16:17 17:30 1:22 Shift Total&lt;/P&gt;&lt;P&gt;bbbbb 12/11/17 Mon 08:56 10:31 1:59 Shift Total&lt;/P&gt;&lt;P&gt;bbbbb 12/11/17 Mon 10:31 10:42 0:17 Rest Break&lt;/P&gt;&lt;P&gt;bbbbb 12/11/17 Mon 10:42 12:54 2:2 Shift Total&lt;/P&gt;&lt;P&gt;bbbbb 12/11/17 Mon 12:54 13:26 0:53 Lunch Break&lt;/P&gt;&lt;P&gt;bbbbb 12/11/17 Mon 13:26 16:09 2:71 Shift Total&lt;/P&gt;&lt;P&gt;bbbbb 12/11/17 Mon 16:09 16:17 0:14 Rest Break&lt;/P&gt;&lt;P&gt;bbbbb 12/11/17 Mon 16:17 17:30 1:22 Shift Total&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;the expected Report&lt;/FONT&gt;&lt;/P&gt;&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39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422076#M103776</guid>
      <dc:creator>tekish</dc:creator>
      <dc:date>2017-12-19T13:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422082#M103778</link>
      <description>&lt;P&gt;I hate that output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would be much easier to deal with dates and time in datetime format and not character format.&amp;nbsp; Can be converted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will there always be a clock in, two breaks, and a lunch for every record, every time?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you need to deal with sick, vacation, holiday, or other kinds of time?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this a real world problem or homework?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 18:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422082#M103778</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2017-12-18T18:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422083#M103779</link>
      <description>&lt;P&gt;Please post code examples into a code box opened with the forum {I} menu icon. As posted your data step has the approval status in the job code and approved is blank. The message windows on this forum reformat text and so the fixed columns for jobcode have been shifted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will likely go better with the times as actual time values instead of character as it appears that you want to calculate intervals to get "shifttotal_1" and "RestBreak1";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if there is some rule for which times would be considered "ShiftTotal_1" or "RestBreak1" that would also help.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 18:43:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422083#M103779</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-18T18:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422087#M103782</link>
      <description>&lt;P&gt;Ballardw,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no rule.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 18:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422087#M103782</guid>
      <dc:creator>tekish</dc:creator>
      <dc:date>2017-12-18T18:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422088#M103783</link>
      <description>&lt;P&gt;HB,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the data in the above format and I want to convert it to the expected report.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 18:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422088#M103783</guid>
      <dc:creator>tekish</dc:creator>
      <dc:date>2017-12-18T18:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422114#M103797</link>
      <description>&lt;P&gt;Well, okay then.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;We don't know if the records stay the same, we don't know nothing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp; Convert the local_date + clock and local_date + clock_out to datetimes (my_clock_in and my_clock_out) for each record.&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; From the data as whole Select records for which job code is shift total&lt;/P&gt;
&lt;P&gt;3.&amp;nbsp; Sort the data by user id and clock_IN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your report&lt;BR /&gt;Clock in appears to be clock_IN of the .first record for a user id&lt;/P&gt;
&lt;P&gt;Shift Total_1 appears to be hours for the .first record for a user id&lt;/P&gt;
&lt;P&gt;Clock out appears to be the clock_out for the .last record for a user id&lt;/P&gt;
&lt;P&gt;Shift Total_4 (assuming you meant 4) appears to be the hours for the .last record&lt;/P&gt;
&lt;P&gt;Shift_total appears to be the difference between my_clock_in on the .first record and my_clock_out on the .last record for a user.&amp;nbsp; This is where the datetime format is useful&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4.&amp;nbsp; From this data subset, select records which are not .first or .last&lt;/P&gt;
&lt;P&gt;Shift Total_2 appears to be hours for the .first record&lt;BR /&gt;Shift Total_3 (assuming you meant 3) appears to be hours for the .last record&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;5.&amp;nbsp; From the data as a whole, select records for which job code is rest break&lt;/P&gt;
&lt;P&gt;6.&amp;nbsp; Sort by userid and clock_in&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rest Break1 appears to be hours for .first record for a user&lt;/P&gt;
&lt;P&gt;Rest Break_2 appears to be hours for the .last record for a user&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;7.&amp;nbsp; Select records for which job code is lunch&lt;/P&gt;
&lt;P&gt;Lunch Break appears to be hours&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;8.&amp;nbsp; Put it all together &lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 19:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422114#M103797</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2017-12-18T19:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422259#M103821</link>
      <description>&lt;P&gt;Some things to think about:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Two columns in the report are named "Shift Total_2", a mistake?&lt;/LI&gt;
&lt;LI&gt;The data in have does not match the data in the expected output.&lt;/LI&gt;
&lt;LI&gt;"hours" is not the difference between "clock_in" and "clock_out".&lt;/LI&gt;
&lt;LI&gt;"approved_status" is unused, why keeping it in "want"?&lt;/LI&gt;
&lt;LI&gt;How should the report look like if someone skipped a break?&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 19 Dec 2017 13:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422259#M103821</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-12-19T13:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422273#M103823</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475" target="_self"&gt;&lt;SPAN class="login-bold"&gt;andreas_lds&lt;/SPAN&gt;&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;real data is similar to the have data,&amp;nbsp;hours is the total worked hours by the employee(clock out -clock in).&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 13:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422273#M103823</guid>
      <dc:creator>tekish</dc:creator>
      <dc:date>2017-12-19T13:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422297#M103831</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input username $ local_date $ local_day $ Clock_IN : time. Clock_out : time. hours : time. jobcode $20.;
format Clock_IN  Clock_out  hours : time.;
cards;
aaaaa 12/11/17 Mon 08:56 10:31 1:59 Shift Total
aaaaa 12/11/17 Mon 10:31 10:42 0:17 Rest Break
aaaaa 12/11/17 Mon 10:42 12:54 2:2 Shift Total
aaaaa 12/11/17 Mon 12:54 13:26 0:53 Lunch Break
aaaaa 12/11/17 Mon 13:26 16:09 2:71 Shift Total
aaaaa 12/11/17 Mon 16:09 16:17 0:14 Rest Break
aaaaa 12/11/17 Mon 16:17 17:30 1:22 Shift Total
bbbbb 12/11/17 Mon 08:56 10:31 1:59 Shift Total
bbbbb 12/11/17 Mon 10:31 10:42 0:17 Rest Break
bbbbb 12/11/17 Mon 10:42 12:54 2:2 Shift Total
bbbbb 12/11/17 Mon 12:54 13:26 0:53 Lunch Break
bbbbb 12/11/17 Mon 13:26 16:09 2:71 Shift Total
bbbbb 12/11/17 Mon 16:09 16:17 0:14 Rest Break
bbbbb 12/11/17 Mon 16:17 17:30 1:22 Shift Total
;
run;

proc sql;
create table temp as
 select *,min(Clock_IN) as min format=time.,max(Clock_out) as max format=time.
  from have
   group by  username , local_date , local_day
    order by  username , local_date , local_day	, jobcode  ,hours;
quit;
data temp1;
 set temp;
 by username local_date local_day jobcode ;
 if first.jobcode then n=0;
 n+1;
run;
proc transpose data=temp1 out=want ;
by username local_date local_day min max;
id jobcode n;
var hours;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Dec 2017 14:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422297#M103831</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-12-19T14:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422321#M103844</link>
      <description>&lt;P&gt;I think that the following comes close to what you want:&lt;/P&gt;
&lt;PRE&gt;data have;
  informat jobcode $11.;
  input username $ local_date $ local_day $ Clock_IN $ Clock_out $ hours $ jobcode &amp;amp;;
  cards;
aaaaa 12/11/17 Mon 08:56 10:31 1:59 Shift Total
aaaaa 12/11/17 Mon 10:31 10:42 0:17 Rest Break
aaaaa 12/11/17 Mon 10:42 12:54 2:2 Shift Total
aaaaa 12/11/17 Mon 12:54 13:26 0:53 Lunch Break
aaaaa 12/11/17 Mon 13:26 16:09 2:71 Shift Total
aaaaa 12/11/17 Mon 16:09 16:17 0:14 Rest Break
aaaaa 12/11/17 Mon 16:17 17:30 1:22 Shift Total
bbbbb 12/11/17 Mon 08:56 10:31 1:59 Shift Total
bbbbb 12/11/17 Mon 10:31 10:42 0:17 Rest Break
bbbbb 12/11/17 Mon 10:42 12:54 2:2 Shift Total
bbbbb 12/11/17 Mon 12:54 13:26 0:53 Lunch Break
bbbbb 12/11/17 Mon 13:26 16:09 2:71 Shift Total
bbbbb 12/11/17 Mon 16:09 16:17 0:14 Rest Break
bbbbb 12/11/17 Mon 16:17 17:30 1:22 Shift Total
;
run;

data need;
  set have;
  by username local_date;
  format _Shift_Total time5.;
  retain _Shift_Total;
  if first.local_date then do;
    i=1;
    _Shift_Total=input(Clock_IN,time5.);
  end;
  else if jobcode eq 'Shift Total' then i+1;
  if last.username then _Shift_Total=input(Clock_out,time5.)-_Shift_Total;
run;

data need;
  format Shift_Total time5.;
  do until (last.local_date);
    set need;
    by username local_date;
    if last.local_date then Shift_Total=_Shift_Total;
  end;
  do until (last.local_date);
    set need;
    by username local_date;
    output;
  end;
run;

proc transpose data=need out=want (where=(not missing(_NAME_)));
  by username local_date;
  copy Shift_Total;
  var hours;
  id jobcode i;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 15:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422321#M103844</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-12-19T15:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422384#M103861</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/51471"&gt;@tekish&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475" target="_self"&gt;&lt;SPAN class="login-bold"&gt;andreas_lds&lt;/SPAN&gt;&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;real data is similar to the have data,&amp;nbsp;hours is the total worked hours by the employee(clock out -clock in).&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is there anything entered for what an employee is out such as a medical appointment? What do you want in the output if only one shift value is present and no breaks, which could happen when out for medical appointment or similar?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 16:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-transpose-column/m-p/422384#M103861</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-19T16:59:42Z</dc:date>
    </item>
  </channel>
</rss>

