05-12-2016
Gothardt
Obsidian | Level 7
Member since
03-25-2016
- 15 Posts
- 9 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by Gothardt
Subject Views Posted 1074 04-29-2016 03:10 AM 1098 04-29-2016 01:24 AM 40764 04-18-2016 06:14 AM 40774 04-18-2016 06:03 AM 1667 04-11-2016 08:16 AM 4932 04-02-2016 06:51 AM 4936 04-02-2016 06:30 AM 4937 04-02-2016 06:28 AM 4970 04-01-2016 08:34 AM 1722 03-31-2016 06:25 AM -
Activity Feed for Gothardt
- Posted Re: All observations in the last row sorted by person on SAS Programming. 04-29-2016 03:10 AM
- Posted All observations in the last row sorted by person on SAS Programming. 04-29-2016 01:24 AM
- Liked Re: How do I create a new date-variable? for Reeza. 04-18-2016 09:39 AM
- Liked Re: How do I create a new date-variable? for RW9. 04-18-2016 09:36 AM
- Posted Re: How do I create a new date-variable? on SAS Programming. 04-18-2016 06:14 AM
- Posted How do I create a new date-variable? on SAS Programming. 04-18-2016 06:03 AM
- Liked Re: Year-variable from a date for ballardw. 04-12-2016 03:22 AM
- Liked Re: Year-variable from a date for FreelanceReinh. 04-11-2016 10:01 AM
- Liked Re: Year-variable from a date for RW9. 04-11-2016 10:01 AM
- Liked Re: Year-variable from a date for FreelanceReinh. 04-11-2016 10:01 AM
- Posted Year-variable from a date on SAS Programming. 04-11-2016 08:16 AM
- Posted Re: How to read data from next line? on SAS Programming. 04-02-2016 06:51 AM
- Posted Re: How to read data from next line? on SAS Programming. 04-02-2016 06:30 AM
- Posted Re: How to read data from next line? on SAS Programming. 04-02-2016 06:28 AM
- Posted How to read data from next line? on SAS Programming. 04-01-2016 08:34 AM
- Liked Re: Time variable for Kurt_Bremser. 04-01-2016 07:55 AM
- Posted Re: Time variable on SAS Programming. 03-31-2016 06:25 AM
- Posted Re: Time variable on SAS Programming. 03-31-2016 05:37 AM
- Posted Re: Time variable on SAS Programming. 03-31-2016 05:07 AM
- Posted Time variable on SAS Programming. 03-31-2016 03:41 AM
-
Posts I Liked
Subject Likes Author Latest Post 4 1 1 1 2
04-29-2016
03:10 AM
Thanks a lot Xia Keshan!
... View more
04-29-2016
01:24 AM
I have this: Id s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 6 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 3 0 0 0 3 0 1 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 1 0 0 0 0 0 0 0 0 0 5 0 0 0 1 0 0 0 3 0 0 6 0 How do I get this (all observations sorted by id in one row)? Id s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 s12 1 1 0 1 0 1 2 0 0 0 6 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 3 0 1 0 0 0 0 0 0 3 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 1 1 0 0 0 3 0 0 6 0
... View more
04-18-2016
06:14 AM
Thanks a lot @naveenraj. Do you also now how I change the format ddmmyy10. (eg. 01/02/2011) to this mm/year (02/2011)?
... View more
04-18-2016
06:03 AM
Dear all SAS-users, I have this: Obs Month Year 1 2 2011 2 3 2011 3 5 2011 4 6 2012 5 6 2012 6 7 2012 7 7 2012 8 8 2013 How do I create a new variable that looks like this: Date 2/2011 3/2011 5/2011 6/2012 6/2012 7/2012 7/2012 8/2013 ?
... View more
04-11-2016
08:16 AM
I have this data set: Obs. Indate 1 1/7/2011 2 3/7/2012 3 5/4/2014 4 1/9/2011 5 8/9/2013 6 1/1/2014 How do I create a new variable (year) which looks like this: Obs. Year 1 2011 2 2012 3 2014 4 2011 5 2013 6 2014
... View more
04-02-2016
06:51 AM
I found out - it seems to work without the view-statement. Thanks a lot!
... View more
04-02-2016
06:30 AM
This datastep dosen't work: data inout2;
set inout2;
by id g;
last = last.g;
run;
proc print; I get: ERROR: BY variable pnr is not on input data set ERROR: BY variable is not on input data set
... View more
04-02-2016
06:28 AM
I've already tried this and it dose not work: all the values of last.line =1...
... View more
04-01-2016
08:34 AM
I have a dataset that looks like this: Obs ID Indate Outdate Lines 1 1 17/08/10 20/08/10 1 2 1 17/08/10 22/08/10 2 3 2 06/01/11 10/01/11 1 4 3 15/08/10 15/08/10 1 5 3 15/08/10 17/08/10 2 6 3 15/08/10 25/08/10 3 7 3 15/08/10 21/09/10 4 8 4 17/06/12 17/06/12 1 9 5 26/01/11 27/01/11 1 10 6 06/11/12 06/11/12 1 11 6 14/12/12 14/12/12 1 12 6 17/11/14 17/11/14 1 13 6 17/11/14 18/11/14 1 14 7 30/10/10 31/10/10 1 15 7 30/10/10 01/11/10 2 And by using the statement: proc sort data=have; by pnr indate; run; data have; set have; by pnr indate; LastLine=last.indate; run; I get this: Obs ID Indate Outdate Lines LastLine 1 1 17/08/10 20/08/10 1 0 2 1 17/08/10 22/08/10 2 1 3 2 06/01/11 10/01/11 1 1 4 3 15/08/10 15/08/10 1 0 5 3 15/08/10 17/08/10 2 0 6 3 15/08/10 25/08/10 3 0 7 3 15/08/10 21/09/10 4 1 8 4 17/06/12 17/06/12 1 1 9 5 26/01/11 27/01/11 1 1 10 6 06/11/12 06/11/12 1 1 11 6 14/12/12 14/12/12 1 1 12 6 17/11/14 17/11/14 1 0 13 6 17/11/14 18/11/14 1 1 14 7 30/10/10 31/10/10 1 0 15 7 30/10/10 01/11/10 2 1 It is correct until observation nr. 12. This should be 1 because Lines=1 in the next row... I've tried to sort by Outdate instead and I have used the lag(indate) but nothings works for me... How do I get it right?
... View more
03-31-2016
06:25 AM
OBS ID INDATE OUTDATE INTIME OUTTIME LASTOUTDATE LASTOUTTIME NUMBERLINES 1 X 15/05/2013 15/05/2013 13 16 . . 1 2 X 16/05/2013 16/05/2013 1 1 15/05/2013 16 2 3 Y 24/12/2014 25/12/2014 14 16 . . 1 4 Z 02/12/2011 03/12/2011 16 23 . . 1 5 Z 04/12/2011 05/12/2011 2 17 03/12/2011 23 2 6 Z 06/12/2011 06/12/2011 1 8 05/12/2011 17 3 7 W 07/08/2012 08/08/2012 14 20 . . 1 8 M 01/01/2012 02/01/2012 16 8 . . 1 9 M 02/01/2012 03/01/2012 9 16 02/01/2012 8 2 I work on a 'secret server' so I cannot take data out. But this is different scenarios like in the dataset (but I have over 400.000 observations, so I cancot make syntaxes for all the exact dates). LASTOUTDATE and LASTOUTIME is made with the lag-function. If first.obs then LASTOUTDATE=. and LASTOUTTIME=. NUMBERLINES indicate wheter the lines are combined or not (and how many times).
... View more
03-31-2016
05:37 AM
But the thing is, I do not know the exact date for all my observations so I have to use a general syntax identifying all observations over midnigt that should be combined (because of <12 hours between).
... View more
03-31-2016
05:07 AM
Thanks for your answer. I have created the timestamp variables. But how to write the INTCK-syntax with interval for hours? In the INTCK-function description I can only find syntaxes for days and months. I could use days and then afterwards calculate hours, but I'm sure there is an easier way?
... View more
03-31-2016
03:41 AM
Dear SAS-experts 🙂 I actually think this is very basic but nevertheless it is causing me some problems. My observations are this: INDATE OUTDATE INTIME OUTTIME LASTOUTDATE LASTOUTTIME 15/05/2013 15/05/2013 13 16 - 16/05/2013 16/05/2013 1 1 15/05/2013 16 (This is European time, ie. 1=1am and 16= 4pm) I want to combine the 2 observations because there is <12 hours between 15/05/2013 16 (4pm) and 16/05/2013 1. How do tell SAS that IN- and OUTTIME have a maximum of 23 hours (and then after starts at 0 on the next day?) I hope it makes sence...
... View more
03-31-2016
03:16 AM
Thanks a lot KurtBremser. It was exactly the commando I needed. 🙂
... View more
03-25-2016
08:11 AM
Hi, I have a dataset sorted by patients; e.g. 2 observations/lines (of data) for patient 1, 4 lines for patient 2 and so on. I have a variable (we call it "LINES") counting the lines for each patient (1, 2, 3, 4 and so on). I need to create a new variable with data from the the last line for each patient, in other words the highest value of the variable "LINES" (sorted by patients). How do I create a syntax with "highest value" (it should bed sorted by patients already) of a variable? /Mette
... View more